Dynamic handle to work with freetype 2 library.
in ROOT7 TTFhandle will completely replace TTF class
Definition at line 21 of file TTFhandle.h.
Classes | |
| struct | FontStruct |
| struct | FT_Library_Wrapper |
| Thread-local wrapper to the freetype library. More... | |
| struct | GlyphStruct |
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 |
| Bool_t | GetKerning () const |
| UInt_t | GetNumGlyphs () const |
| return number of glyphs | |
| Bool_t | GetSmoothing () const |
| 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 | Init () |
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 | |
| Bool_t | fHinting = kFALSE |
| use hinting (false by default) | |
| Bool_t | fKerning = kTRUE |
| use kerning (true by default) | |
| long | fRotationXX = 0 |
| long | fRotationXY = 0 |
| rotation matrix members | |
| Bool_t | fSmoothing = kTRUE |
| 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 |
Friends | |
| class | TTF |
#include <TTFhandle.h>
| TTFhandle::TTFhandle | ( | ) |
Definition at line 87 of file TTFhandle.cxx.
|
virtual |
Definition at line 95 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 308 of file TTFhandle.cxx.
Map char to unicode. Returns 0 in case no mapping exists.
Definition at line 103 of file TTFhandle.cxx.
Definition at line 97 of file TTFhandle.h.
| void TTFhandle::CleanupGlyphs | ( | ) |
Remove temporary data created by LayoutGlyphs.
Definition at line 417 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 133 of file TTFhandle.cxx.
Definition at line 97 of file TTFhandle.h.
|
private |
Fill vector from TTF class Only for backward compatibility of old API.
Definition at line 288 of file TTFhandle.cxx.
|
inline |
Definition at line 76 of file TTFhandle.h.
|
inline |
Definition at line 80 of file TTFhandle.h.
|
inline |
Definition at line 79 of file TTFhandle.h.
|
inline |
Definition at line 82 of file TTFhandle.h.
|
inline |
Definition at line 81 of file TTFhandle.h.
| void * TTFhandle::GetFontFace | ( | ) | const |
Return current font index.
Definition at line 479 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 385 of file TTFhandle.cxx.
| Int_t TTFhandle::GetGlyphsHeight | ( | ) | const |
Returns height of all glyphs.
Definition at line 374 of file TTFhandle.cxx.
| Int_t TTFhandle::GetGlyphsWidth | ( | ) | const |
Returns width of all glyphs.
Definition at line 366 of file TTFhandle.cxx.
|
inline |
Definition at line 65 of file TTFhandle.h.
|
inline |
Definition at line 66 of file TTFhandle.h.
| UInt_t TTFhandle::GetNumGlyphs | ( | ) | const |
return number of glyphs
Definition at line 278 of file TTFhandle.cxx.
|
inline |
Definition at line 64 of file TTFhandle.h.
Get advance (a) when text is horizontal.
Definition at line 167 of file TTFhandle.cxx.
Get width (w) and height (h) when text is horizontal.
Definition at line 154 of file TTFhandle.cxx.
Get width (w) and height (h) when text is horizontal.
Definition at line 179 of file TTFhandle.cxx.
|
inline |
Definition at line 77 of file TTFhandle.h.
|
inline |
Definition at line 78 of file TTFhandle.h.
|
static |
Definition at line 726 of file TTFhandle.cxx.
Definition at line 97 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 196 of file TTFhandle.cxx.
| void TTFhandle::PrepareString | ( | const char * | string | ) |
Put the characters in "string" in the "glyphs" array.
Definition at line 425 of file TTFhandle.cxx.
Put the characters in "string" in the "glyphs" array.
Definition at line 450 of file TTFhandle.cxx.
Return thread_local instance of FontStruct for speified font.
Definition at line 515 of file TTFhandle.cxx.
|
inline |
Definition at line 57 of file TTFhandle.h.
|
inline |
Definition at line 58 of file TTFhandle.h.
| void TTFhandle::SetRotationMatrix | ( | Float_t | angle | ) |
Set the rotation matrix used to rotate the font outlines.
Definition at line 487 of file TTFhandle.cxx.
|
inline |
Definition at line 56 of file TTFhandle.h.
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 561 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 630 of file TTFhandle.cxx.
Set current text size.
Definition at line 697 of file TTFhandle.cxx.
|
inline |
Definition at line 97 of file TTFhandle.h.
Definition at line 718 of file TTFhandle.cxx.
Definition at line 22 of file TTFhandle.h.
|
private |
string ascent, used to compute Y alignment
Definition at line 36 of file TTFhandle.h.
|
private |
selected font
Definition at line 33 of file TTFhandle.h.
|
staticprivate |
Definition at line 48 of file TTFhandle.h.
|
private |
glyphs
Definition at line 35 of file TTFhandle.h.
use hinting (false by default)
Definition at line 31 of file TTFhandle.h.
use kerning (true by default)
Definition at line 29 of file TTFhandle.h.
|
private |
Definition at line 34 of file TTFhandle.h.
|
private |
rotation matrix members
Definition at line 34 of file TTFhandle.h.
use anti-aliasing (true when >8 planes, false otherwise)
Definition at line 30 of file TTFhandle.h.
|
private |
trailing blanks width
Definition at line 38 of file TTFhandle.h.
|
private |
string width, used to compute X alignment
Definition at line 39 of file TTFhandle.h.
|
private |
Definition at line 37 of file TTFhandle.h.
|
private |
Definition at line 37 of file TTFhandle.h.
|
private |
boundaries
Definition at line 37 of file TTFhandle.h.
|
private |
Definition at line 37 of file TTFhandle.h.