Dynamic handle to work with freetype 2 library.
in ROOT7 TTFhandle will completely replace TTF class
Definition at line 22 of file TTFhandle.h.
Classes | |
| struct | FontStruct |
| struct | FT_Library_Wrapper |
| Thread-local wrapper to the freetype library. More... | |
| struct | GlyphStruct |
| class | Tristate |
Public Member Functions | |
| TTFhandle () | |
| virtual | ~TTFhandle () |
| Bool_t | ApplyAlignRotate (Int_t &px, Int_t &py, Int_t align, Int_t pad_width, Int_t pad_height) |
| Apply align and configured rotation matrix to text position px and py will be shifted to the place where glyph drawing can be started Method returns false when glyphs not need to be drawn while position is outside of specified pad dimentsions. | |
| void | CleanupGlyphs () |
| Remove temporary data created by LayoutGlyphs. | |
| Int_t | GetAscent () const |
| long | GetBoxXMax () const |
| long | GetBoxXMin () const |
| long | GetBoxYMax () const |
| long | GetBoxYMin () const |
| void * | GetFontFace () const |
| Return current font index. | |
| Bool_t | GetGlyphData (UInt_t n, Int_t &offx, Int_t &offy, UChar_t *&buffer, UInt_t &width, UInt_t &rows, UInt_t &pitch) |
| Returns data for glyph bitmap Instead direct access to FT_BitmapGlyph one can obtain all relevant fields Thus one do not requires work with TrueType classes directly Return kFALSE when glyph not exists or if it width is zero. | |
| Int_t | GetGlyphsHeight () const |
| Returns height of all glyphs. | |
| Int_t | GetGlyphsWidth () const |
| Returns width of all glyphs. | |
| Bool_t | GetHinting () const |
| Returns true if hinting for this instance is enabled If SetHinting() was not called before - use global value configured with SetHinitingPrefer method. | |
| Bool_t | GetKerning () const |
| Returns true if kerning for this instance is enabled If SetKerning() was not called before - use global value configured with SetKerningPrefer method. | |
| UInt_t | GetNumGlyphs () const |
| return number of glyphs | |
| Bool_t | GetSmoothing () const |
| Returns true if smoothing for this instance is enabled If SetSmoothing() was not called before - use global value configured with SetSmoothingPrefer method. | |
| void | GetTextAdvance (UInt_t &a, const char *text) |
| Get advance (a) when text is horizontal. | |
| void | GetTextExtent (UInt_t &w, UInt_t &h, const char *text) |
| Get width (w) and height (h) when text is horizontal. | |
| void | GetTextExtent (UInt_t &w, UInt_t &h, const wchar_t *text) |
| Get width (w) and height (h) when text is horizontal. | |
| Int_t | GetTrailingBlanksWidth () const |
| Int_t | GetWidth () const |
| virtual TClass * | IsA () const |
| void | LayoutGlyphs () |
| Compute the glyphs positions, fgAscent and fgWidth (needed for alignment). | |
| void | PrepareString (const char *string) |
| Put the characters in "string" in the "glyphs" array. | |
| void | PrepareString (const wchar_t *string) |
| Put the characters in "string" in the "glyphs" array. | |
| void | SetHinting (Bool_t state) |
| void | SetKerning (Bool_t state) |
| void | SetRotationMatrix (Float_t angle) |
| Set the rotation matrix used to rotate the font outlines. | |
| void | SetSmoothing (Bool_t state) |
| Int_t | SetTextFont (const char *fontname, Int_t italic=0) |
| Set text font to specified name. | |
| void | SetTextFont (Font_t fontnumber) |
| Set specified font. | |
| Bool_t | SetTextSize (Float_t textsize) |
| Set current text size. | |
| virtual void | Streamer (TBuffer &) |
| void | StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b) |
| void | Version (Int_t &major, Int_t &minor, Int_t &patch) |
Static Public Member Functions | |
| static TClass * | Class () |
| static const char * | Class_Name () |
| static constexpr Version_t | Class_Version () |
| static const char * | DeclFileName () |
| static Bool_t | GetHintingPrefer () |
| Returns true if hinting of text drawing is enabled by default. | |
| static Bool_t | GetKerningPrefer () |
| Returns true if kerning of text drawing is enabled by default. | |
| static Bool_t | GetSmoothingPrefer () |
| Returns true if smoothing of text drawing is enabled by default. | |
| static Bool_t | Init () |
| static void | SetHintingPrefer (Bool_t on) |
| Set global flag to switch on/off hinting of TTF text drawing This flag is used when SetHiniting() flag not set before. | |
| static void | SetKerningPrefer (Bool_t on) |
| Set global flag to switch on/off kerning of TTF text drawing This flag is used when SetKerning() flag not set before. | |
| static void | SetSmoothingPrefer (Bool_t on) |
| Set global flag to switch on/off smoothing of TTF text drawing This flag is used when SetSmoothing() flag not set before. | |
Private Member Functions | |
| UInt_t | CharToUnicode (UInt_t code) |
| Map char to unicode. Returns 0 in case no mapping exists. | |
| void | ComputeTrailingBlanksWidth (Int_t n) |
| Compute the trailing blanks width. | |
| void | FillTTFGlypths (void *vect) |
| Fill vector from TTF class Only for backward compatibility of old API. | |
| Int_t | SelectFontHandle (Int_t arg, const char *name=nullptr) |
| Return thread_local instance of FontStruct for speified font. | |
Private Attributes | |
| Int_t | fAscent = 0 |
| string ascent, used to compute Y alignment | |
| FontStruct * | fFont = nullptr |
| selected font | |
| std::vector< GlyphStruct > | fGlyphs |
| glyphs | |
| Tristate | fHinting |
| use hinting (false by default) | |
| Tristate | fKerning |
| use kerning (true by default) | |
| long | fRotationXX = 0 |
| long | fRotationXY = 0 |
| rotation matrix members | |
| Tristate | fSmoothing |
| use anti-aliasing (true when >8 planes, false otherwise) | |
| Int_t | fTBlankW = 0 |
| trailing blanks width | |
| Int_t | fWidth = 0 |
| string width, used to compute X alignment | |
| long | xMax = 0 |
| long | xMin = 0 |
| long | yMax = 0 |
| boundaries | |
| long | yMin = 0 |
Static Private Attributes | |
| static thread_local FT_Library_Wrapper | fFT_Library |
| static std::atomic< Bool_t > | fKerningPrefer = kTRUE |
| static std::atomic< Bool_t > | gHintingPrefer = kFALSE |
| static std::atomic< Bool_t > | gSmoothingPrefer = kTRUE |
Friends | |
| class | TTF |
#include <TTFhandle.h>
| TTFhandle::TTFhandle | ( | ) |
Definition at line 94 of file TTFhandle.cxx.
|
virtual |
Definition at line 102 of file TTFhandle.cxx.
| Bool_t TTFhandle::ApplyAlignRotate | ( | Int_t & | px, |
| Int_t & | py, | ||
| Int_t | align, | ||
| Int_t | pad_width, | ||
| Int_t | pad_height ) |
Apply align and configured rotation matrix to text position px and py will be shifted to the place where glyph drawing can be started Method returns false when glyphs not need to be drawn while position is outside of specified pad dimentsions.
Definition at line 324 of file TTFhandle.cxx.
Map char to unicode. Returns 0 in case no mapping exists.
Definition at line 110 of file TTFhandle.cxx.
|
static |
|
inlinestaticconstexpr |
Definition at line 114 of file TTFhandle.h.
| void TTFhandle::CleanupGlyphs | ( | ) |
Remove temporary data created by LayoutGlyphs.
Definition at line 433 of file TTFhandle.cxx.
|
private |
Compute the trailing blanks width.
It is use to compute the text width in GetTextExtent n is the number of trailing blanks in a string.
Definition at line 140 of file TTFhandle.cxx.
|
inlinestatic |
Definition at line 114 of file TTFhandle.h.
|
private |
Fill vector from TTF class Only for backward compatibility of old API.
Definition at line 304 of file TTFhandle.cxx.
|
inline |
Definition at line 87 of file TTFhandle.h.
|
inline |
Definition at line 91 of file TTFhandle.h.
|
inline |
Definition at line 90 of file TTFhandle.h.
|
inline |
Definition at line 93 of file TTFhandle.h.
|
inline |
Definition at line 92 of file TTFhandle.h.
| void * TTFhandle::GetFontFace | ( | ) | const |
Return current font index.
Definition at line 495 of file TTFhandle.cxx.
| Bool_t TTFhandle::GetGlyphData | ( | UInt_t | n, |
| Int_t & | offx, | ||
| Int_t & | offy, | ||
| UChar_t *& | buffer, | ||
| UInt_t & | width, | ||
| UInt_t & | rows, | ||
| UInt_t & | pitch ) |
Returns data for glyph bitmap Instead direct access to FT_BitmapGlyph one can obtain all relevant fields Thus one do not requires work with TrueType classes directly Return kFALSE when glyph not exists or if it width is zero.
Definition at line 401 of file TTFhandle.cxx.
| Int_t TTFhandle::GetGlyphsHeight | ( | ) | const |
Returns height of all glyphs.
Definition at line 390 of file TTFhandle.cxx.
| Int_t TTFhandle::GetGlyphsWidth | ( | ) | const |
Returns width of all glyphs.
Definition at line 382 of file TTFhandle.cxx.
| Bool_t TTFhandle::GetHinting | ( | ) | const |
Returns true if hinting for this instance is enabled If SetHinting() was not called before - use global value configured with SetHinitingPrefer method.
Definition at line 815 of file TTFhandle.cxx.
|
static |
Returns true if hinting of text drawing is enabled by default.
Definition at line 793 of file TTFhandle.cxx.
| Bool_t TTFhandle::GetKerning | ( | ) | const |
Returns true if kerning for this instance is enabled If SetKerning() was not called before - use global value configured with SetKerningPrefer method.
Definition at line 827 of file TTFhandle.cxx.
|
static |
Returns true if kerning of text drawing is enabled by default.
Definition at line 759 of file TTFhandle.cxx.
| UInt_t TTFhandle::GetNumGlyphs | ( | ) | const |
return number of glyphs
Definition at line 294 of file TTFhandle.cxx.
| Bool_t TTFhandle::GetSmoothing | ( | ) | const |
Returns true if smoothing for this instance is enabled If SetSmoothing() was not called before - use global value configured with SetSmoothingPrefer method.
Definition at line 803 of file TTFhandle.cxx.
|
static |
Returns true if smoothing of text drawing is enabled by default.
Definition at line 776 of file TTFhandle.cxx.
| void TTFhandle::GetTextAdvance | ( | UInt_t & | a, |
| const char * | text ) |
Get advance (a) when text is horizontal.
Definition at line 174 of file TTFhandle.cxx.
Get width (w) and height (h) when text is horizontal.
Definition at line 161 of file TTFhandle.cxx.
Get width (w) and height (h) when text is horizontal.
Definition at line 186 of file TTFhandle.cxx.
|
inline |
Definition at line 88 of file TTFhandle.h.
|
inline |
Definition at line 89 of file TTFhandle.h.
|
static |
Definition at line 742 of file TTFhandle.cxx.
|
inlinevirtual |
Definition at line 114 of file TTFhandle.h.
| void TTFhandle::LayoutGlyphs | ( | ) |
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
Perform the Glyphs transformation. Compute the string control box. If required take the "kerning" into account. SetRotation and PrepareString should have been called before.
Definition at line 203 of file TTFhandle.cxx.
| void TTFhandle::PrepareString | ( | const char * | string | ) |
Put the characters in "string" in the "glyphs" array.
Definition at line 441 of file TTFhandle.cxx.
| void TTFhandle::PrepareString | ( | const wchar_t * | string | ) |
Put the characters in "string" in the "glyphs" array.
Definition at line 466 of file TTFhandle.cxx.
Return thread_local instance of FontStruct for speified font.
Definition at line 531 of file TTFhandle.cxx.
|
inline |
Definition at line 68 of file TTFhandle.h.
|
static |
Set global flag to switch on/off hinting of TTF text drawing This flag is used when SetHiniting() flag not set before.
Definition at line 785 of file TTFhandle.cxx.
|
inline |
Definition at line 69 of file TTFhandle.h.
|
static |
Set global flag to switch on/off kerning of TTF text drawing This flag is used when SetKerning() flag not set before.
Definition at line 751 of file TTFhandle.cxx.
| void TTFhandle::SetRotationMatrix | ( | Float_t | angle | ) |
Set the rotation matrix used to rotate the font outlines.
Definition at line 503 of file TTFhandle.cxx.
|
inline |
Definition at line 67 of file TTFhandle.h.
|
static |
Set global flag to switch on/off smoothing of TTF text drawing This flag is used when SetSmoothing() flag not set before.
Definition at line 768 of file TTFhandle.cxx.
Set text font to specified name.
Set text font to specified name. This function returns 0 if the specified font is found, 1 if not.
Definition at line 577 of file TTFhandle.cxx.
| void TTFhandle::SetTextFont | ( | Font_t | fontnumber | ) |
Set specified font.
List of the currently supported fonts (screen and PostScript)
| Font number | TTF Names | PostScript/PDF Names |
|---|---|---|
| 1 | Free Serif Italic | Times-Italic |
| 2 | Free Serif Bold | Times-Bold |
| 3 | Free Serif Bold Italic | Times-BoldItalic |
| 4 | Tex Gyre Regular | Helvetica |
| 5 | Tex Gyre Italic | Helvetica-Oblique |
| 6 | Tex Gyre Bold | Helvetica-Bold |
| 7 | Tex Gyre Bold Italic | Helvetica-BoldOblique |
| 8 | Free Mono | Courier |
| 9 | Free Mono Oblique | Courier-Oblique |
| 10 | Free Mono Bold | Courier-Bold |
| 11 | Free Mono Bold Oblique | Courier-BoldOblique |
| 12 | Symbol | Symbol |
| 13 | Free Serif | Times-Roman |
| 14 | Wingdings | ZapfDingbats |
Definition at line 646 of file TTFhandle.cxx.
Set current text size.
Definition at line 713 of file TTFhandle.cxx.
|
virtual |
|
inline |
Definition at line 114 of file TTFhandle.h.
Definition at line 734 of file TTFhandle.cxx.
|
friend |
Definition at line 23 of file TTFhandle.h.
|
private |
string ascent, used to compute Y alignment
Definition at line 44 of file TTFhandle.h.
|
private |
selected font
Definition at line 41 of file TTFhandle.h.
|
staticprivate |
Definition at line 56 of file TTFhandle.h.
|
private |
glyphs
Definition at line 43 of file TTFhandle.h.
|
private |
use hinting (false by default)
Definition at line 39 of file TTFhandle.h.
|
private |
use kerning (true by default)
Definition at line 37 of file TTFhandle.h.
Definition at line 59 of file TTFhandle.h.
|
private |
Definition at line 42 of file TTFhandle.h.
|
private |
rotation matrix members
Definition at line 42 of file TTFhandle.h.
|
private |
use anti-aliasing (true when >8 planes, false otherwise)
Definition at line 38 of file TTFhandle.h.
|
private |
trailing blanks width
Definition at line 46 of file TTFhandle.h.
|
private |
string width, used to compute X alignment
Definition at line 47 of file TTFhandle.h.
Definition at line 58 of file TTFhandle.h.
Definition at line 57 of file TTFhandle.h.
|
private |
Definition at line 45 of file TTFhandle.h.
|
private |
Definition at line 45 of file TTFhandle.h.
|
private |
boundaries
Definition at line 45 of file TTFhandle.h.
|
private |
Definition at line 45 of file TTFhandle.h.