Skip to content

Provide none-static interface for TTF#22098

Draft
linev wants to merge 3 commits intoroot-project:masterfrom
linev:ttf_normal_class
Draft

Provide none-static interface for TTF#22098
linev wants to merge 3 commits intoroot-project:masterfrom
linev:ttf_normal_class

Conversation

@linev
Copy link
Copy Markdown
Member

@linev linev commented Apr 29, 2026

Now TTF class uses fully static API - no chance to run code parallel.
Also there are several static arrays preallocated - which leads to certain limitations.
While old TTF.h API must be preserved until ROOT7, just introduce extra TTFhandle class which should
provide "normal" API without all static limitations. Old static API redirects to new static instance of std::unique_ptr<TTFhandle>.

All ROOT classes will be switched to use new API - so static interfaces will be only available for users.

linev added 3 commits April 29, 2026 11:04
Provide several getters which replace such direct access.
Remove friend classes - no any allows to use members from outside.
They will disappear soon
It is future replacement for static TTF interface.
For now it define similar methods and TTF just call to static instance -
fully preserve API as it was before.
In ROOT7 TTFhandle class will fully replace TTF.
All ROOT classes will use new API
@linev linev self-assigned this Apr 29, 2026
@linev linev requested a review from couet as a code owner April 29, 2026 09:10
@linev linev marked this pull request as draft April 29, 2026 09:10
Comment thread graf2d/graf/inc/TTF.h
std::vector<TTF::TTGlyph> fGlyphs; ///< glyphs
Bool_t fHinting = kFALSE; ///< use hinting (true by default)
Bool_t fKerning = kTRUE; ///< use kerning (true by default)
std::unique_ptr<FT_Matrix> fRotMatrix; ///< rotation matrix
Copy link
Copy Markdown
Contributor

@silverweed silverweed Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be a separate allocation? Can't we just store it inline?

Edit: sorry, just noticed this is still a draft.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to emulate old API.
And these were many static members before.
Some of them used outside of TTF parsing.

Copy link
Copy Markdown
Contributor

@silverweed silverweed Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I mean why the matrix specifically needs to be wrapped in a unique_ptr? That should not be required for backward compatibility

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean why the matrix specifically needs to be wrapped in a unique_ptr

unique_ptr will automatically delete matrix in the destructor of TTFhandle.
Just simple sign of ownership.

PR is not yet ready - I just want to check that functionality is still there.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant why is the matrix is not there by value, why the dynamic allocation at all

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No idea. Maybe you are right and dynamic allocation not needed at all.

I checking this and many other things right now.

@github-actions
Copy link
Copy Markdown

Test Results

    21 files      21 suites   3d 6h 18m 13s ⏱️
 3 852 tests  3 800 ✅ 0 💤 52 ❌
72 550 runs  72 497 ✅ 0 💤 53 ❌

For more details on these failures, see this check.

Results for commit 4dbdefd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants