Provide none-static interface for TTF#22098
Merged
Merged
Conversation
Use instead normal getters
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
silverweed
reviewed
Apr 29, 2026
Test Results 22 files 22 suites 3d 13h 16m 41s ⏱️ For more details on these failures, see this check. Results for commit ca0efb7. ♻️ This comment has been updated with latest results. |
Idea to make library and fonts handles thread local In such case multi-threaded usage will be safe. Make special method to intialize or close library Inside thread_local library handle is managed And also add SelectFontHandle method where thread_local list of font handles are trated. Directly change TMathText while it used font index functions which are now gone - but were introduced few days ago
When every symbol drawn in TMathText, use `bounding_box_char` method to get current position. Only in `bounding_box_char` analyze cyrillic symbols and adjust TTF settings. Use new TPad method to get width and height, remove unused members
It does not rely on global TTF state.
Several methods was introduced to TTF class for TMathText support. Now these methods no longer used and can be removed
Instead of global state - use temporary handle for getting text extent
Like in old interface, for new TTFhandle class make these members static They are changed in the very beginning and globally depending from display
Avoid change of global state
Fully avoids global state, text attributes applied only when actual renderning happens
Avoid change of global state Apply text attributes only when needed As on other platforms, make single method to render string
Like on X11, combine all in one method
It converts Glyph to bitmap by calling FT_Glyph_To_Bitmap. Let incapsulate ttf functionality in central class
Simplify loops over the glyphs, expose less FT functionality to next level
couet
approved these changes
May 5, 2026
Use std::vector to calculate average background color Do not use static colors to avoid potential conflicts Always QueryColors and recalculate smoothing colors Use unsigned x/y index values
Do not use static variables for colors Use proper signed/unsigned for loop indexes
Do not use static colors Correctly count average for background color Use proper signed/unsigned indecies in loops
Correctly recalculate smooth colors - no static use Use proper signed/unsigned for loop indecies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now TTF class uses fully static API - no chance to run code in parallel.
Also there are several static arrays preallocated - which leads to certain limitations.
Introduce new
TTFhandleclass which provides "normal" API without all previous static limitations.ttf library handle and fonts lists created per-thread using
thread_localinstances.Thus functionality can be used from many threads without limitation.
Old
TTFclass API preserved until ROOT7.It creates static instance of
std::unique_ptr<TTFhandle>and redirect all calls to it.All ROOT classes tested first with modified
TTFimplementation and then converted to usenew API.
Important improvement - there is no global state for text attributes which was always set to static
TTFmembersby each call to
TAttText::Modify(). Now text attributes preserved inTVirtualXinstance and applied to temporaryTTFhandleinstance only when text is painted.Adjust all
DrawFTGlyphmethods to have similar structure. Avoid static variables for smooth colors