Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TTF Class Reference

Interface to the freetype 2 library.

Definition at line 53 of file TTF.h.

Classes

class  TTGlyph
 TTF helper class containing glyphs description. More...
 

Public Member Functions

 TTF ()
 
virtual ~TTF ()
 Cleanup TTF environment.
 
virtual TClassIsA () const
 
virtual void Streamer (TBuffer &)
 
void StreamerNVirtual (TBuffer &ClassDef_StreamerNVirtual_b)
 

Static Public Member Functions

static Short_t CharToUnicode (UInt_t code)
 Map char to unicode. Returns 0 in case no mapping exists.
 
static TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static void Cleanup ()
 Cleanup. Is called by the gCleanupTTF destructor.
 
static const char * DeclFileName ()
 
static Int_t GetAscent ()
 
static const FT_BBox & GetBox ()
 
static TTGlyphGetGlyphs ()
 
static Bool_t GetHinting ()
 
static Bool_t GetKerning ()
 
static Int_t GetNumGlyphs ()
 
static FT_Matrix * GetRotMatrix ()
 
static Bool_t GetSmoothing ()
 
static void GetTextAdvance (UInt_t &a, char *text)
 Get advance (a) when text is horizontal.
 
static void GetTextExtent (UInt_t &w, UInt_t &h, char *text)
 Get width (w) and height (h) when text is horizontal.
 
static void GetTextExtent (UInt_t &w, UInt_t &h, wchar_t *text)
 Get width (w) and height (h) when text is horizontal.
 
static Int_t GetWidth ()
 
static void Init ()
 Initialise the TrueType fonts interface.
 
static Bool_t IsInitialized ()
 
static void LayoutGlyphs ()
 Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
 
static void PrepareString (const char *string)
 Put the characters in "string" in the "glyphs" array.
 
static void PrepareString (const wchar_t *string)
 Put the characters in "string" in the "glyphs" array.
 
static void SetHinting (Bool_t state)
 Set hinting flag.
 
static void SetKerning (Bool_t state)
 Set kerning flag.
 
static void SetRotationMatrix (Float_t angle)
 Set the rotation matrix used to rotate the font outlines.
 
static void SetSmoothing (Bool_t state)
 Set smoothing (anti-aliasing) flag.
 
static Int_t SetTextFont (const char *fontname, Int_t italic=0)
 Set text font to specified name.
 
static void SetTextFont (Font_t fontnumber)
 Set specified font.
 
static void SetTextSize (Float_t textsize)
 Set current text size.
 
static void Version (Int_t &major, Int_t &minor, Int_t &patch)
 

Protected Types

enum  { kTTMaxFonts = 32 , kMaxGlyphs = 1024 }
 

Static Protected Attributes

static Int_t fgAscent = 0
 string ascent, used to compute Y alignment
 
static FT_BBox fgCBox
 string control box
 
static FT_CharMap fgCharMap [kTTMaxFonts]
 font character map
 
static Int_t fgCurFontIdx = -1
 current font index
 
static FT_Face fgFace [kTTMaxFonts]
 font face
 
static Int_t fgFontCount = 0
 number of fonts loaded
 
static char * fgFontName [kTTMaxFonts]
 font name
 
static TTF::TTGlyph fgGlyphs [kMaxGlyphs]
 glyphs
 
static Bool_t fgHinting = kFALSE
 use hinting (true by default)
 
static Bool_t fgInit = kFALSE
 true if the Init has been called
 
static Bool_t fgKerning = kTRUE
 use kerning (true by default)
 
static FT_Library fgLibrary
 FreeType font library.
 
static Int_t fgNumGlyphs = 0
 number of glyphs in the string
 
static FT_Matrix * fgRotMatrix = nullptr
 rotation matrix
 
static Bool_t fgSmoothing = kTRUE
 use anti-aliasing (true when >8 planes, false otherwise)
 
static Int_t fgSymbItaFontIdx = -1
 Symbol italic font index.
 
static Int_t fgTBlankW = 0
 trailing blanks width
 
static Int_t fgWidth = 0
 string width, used to compute X alignment
 

Friends

class TGWin32
 
class TGX11TTF
 
class TMathTextRenderer
 

#include <TTF.h>

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
kTTMaxFonts 
kMaxGlyphs 

Definition at line 73 of file TTF.h.

Constructor & Destructor Documentation

◆ TTF()

TTF::TTF ( )
inline

Definition at line 102 of file TTF.h.

◆ ~TTF()

TTF::~TTF ( )
virtual

Cleanup TTF environment.

Definition at line 57 of file TTF.cxx.

Member Function Documentation

◆ CharToUnicode()

Short_t TTF::CharToUnicode ( UInt_t  code)
static

Map char to unicode. Returns 0 in case no mapping exists.

Definition at line 99 of file TTF.cxx.

◆ Class()

static TClass * TTF::Class ( )
static
Returns
TClass describing this class

◆ Class_Name()

static const char * TTF::Class_Name ( )
static
Returns
Name of this class

◆ Class_Version()

static constexpr Version_t TTF::Class_Version ( )
inlinestaticconstexpr
Returns
Version of this class

Definition at line 128 of file TTF.h.

◆ Cleanup()

void TTF::Cleanup ( )
static

Cleanup. Is called by the gCleanupTTF destructor.

Definition at line 82 of file TTF.cxx.

◆ DeclFileName()

static const char * TTF::DeclFileName ( )
inlinestatic
Returns
Name of the file containing the class declaration

Definition at line 128 of file TTF.h.

◆ GetAscent()

Int_t TTF::GetAscent ( )
static

Definition at line 623 of file TTF.cxx.

◆ GetBox()

const FT_BBox & TTF::GetBox ( )
static

Definition at line 644 of file TTF.cxx.

◆ GetGlyphs()

TTF::TTGlyph * TTF::GetGlyphs ( )
static

Definition at line 651 of file TTF.cxx.

◆ GetHinting()

Bool_t TTF::GetHinting ( )
static

Definition at line 588 of file TTF.cxx.

◆ GetKerning()

Bool_t TTF::GetKerning ( )
static

Definition at line 595 of file TTF.cxx.

◆ GetNumGlyphs()

Int_t TTF::GetNumGlyphs ( )
static

Definition at line 630 of file TTF.cxx.

◆ GetRotMatrix()

FT_Matrix * TTF::GetRotMatrix ( )
static

Definition at line 637 of file TTF.cxx.

◆ GetSmoothing()

Bool_t TTF::GetSmoothing ( )
static

Definition at line 602 of file TTF.cxx.

◆ GetTextAdvance()

void TTF::GetTextAdvance ( UInt_t a,
char *  text 
)
static

Get advance (a) when text is horizontal.

Definition at line 148 of file TTF.cxx.

◆ GetTextExtent() [1/2]

void TTF::GetTextExtent ( UInt_t w,
UInt_t h,
char *  text 
)
static

Get width (w) and height (h) when text is horizontal.

Definition at line 132 of file TTF.cxx.

◆ GetTextExtent() [2/2]

void TTF::GetTextExtent ( UInt_t w,
UInt_t h,
wchar_t *  text 
)
static

Get width (w) and height (h) when text is horizontal.

Definition at line 161 of file TTF.cxx.

◆ GetWidth()

Int_t TTF::GetWidth ( )
static

Definition at line 616 of file TTF.cxx.

◆ Init()

void TTF::Init ( )
static

Initialise the TrueType fonts interface.

Definition at line 65 of file TTF.cxx.

◆ IsA()

virtual TClass * TTF::IsA ( ) const
inlinevirtual
Returns
TClass describing current object

Definition at line 128 of file TTF.h.

◆ IsInitialized()

Bool_t TTF::IsInitialized ( )
static

Definition at line 609 of file TTF.cxx.

◆ LayoutGlyphs()

void TTF::LayoutGlyphs ( )
static

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 181 of file TTF.cxx.

◆ PrepareString() [1/2]

void TTF::PrepareString ( const char *  string)
static

Put the characters in "string" in the "glyphs" array.

Definition at line 250 of file TTF.cxx.

◆ PrepareString() [2/2]

void TTF::PrepareString ( const wchar_t *  string)
static

Put the characters in "string" in the "glyphs" array.

Definition at line 288 of file TTF.cxx.

◆ SetHinting()

void TTF::SetHinting ( Bool_t  state)
static

Set hinting flag.

Definition at line 326 of file TTF.cxx.

◆ SetKerning()

void TTF::SetKerning ( Bool_t  state)
static

Set kerning flag.

Definition at line 334 of file TTF.cxx.

◆ SetRotationMatrix()

void TTF::SetRotationMatrix ( Float_t  angle)
static

Set the rotation matrix used to rotate the font outlines.

Definition at line 342 of file TTF.cxx.

◆ SetSmoothing()

void TTF::SetSmoothing ( Bool_t  state)
static

Set smoothing (anti-aliasing) flag.

Definition at line 365 of file TTF.cxx.

◆ SetTextFont() [1/2]

Int_t TTF::SetTextFont ( const char *  fontname,
Int_t  italic = 0 
)
static

Set text font to specified name.

  • font : font name
  • italic : the fonts should be slanted. Used for symbol font.

Set text font to specified name. This function returns 0 if the specified font is found, 1 if not.

Definition at line 378 of file TTF.cxx.

◆ SetTextFont() [2/2]

void TTF::SetTextFont ( Font_t  fontnumber)
static

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 490 of file TTF.cxx.

◆ SetTextSize()

void TTF::SetTextSize ( Float_t  textsize)
static

Set current text size.

Definition at line 561 of file TTF.cxx.

◆ Streamer()

virtual void TTF::Streamer ( TBuffer )
virtual

◆ StreamerNVirtual()

void TTF::StreamerNVirtual ( TBuffer ClassDef_StreamerNVirtual_b)
inline

Definition at line 128 of file TTF.h.

◆ Version()

void TTF::Version ( Int_t major,
Int_t minor,
Int_t patch 
)
static

Definition at line 581 of file TTF.cxx.

Friends And Related Symbol Documentation

◆ TGWin32

friend class TGWin32
friend

Definition at line 56 of file TTF.h.

◆ TGX11TTF

friend class TGX11TTF
friend

Definition at line 55 of file TTF.h.

◆ TMathTextRenderer

friend class TMathTextRenderer
friend

Definition at line 57 of file TTF.h.

Member Data Documentation

◆ fgAscent

Int_t TTF::fgAscent = 0
staticprotected

string ascent, used to compute Y alignment

Definition at line 75 of file TTF.h.

◆ fgCBox

FT_BBox TTF::fgCBox
staticprotected

string control box

Definition at line 76 of file TTF.h.

◆ fgCharMap

FT_CharMap TTF::fgCharMap
staticprotected

font character map

Definition at line 77 of file TTF.h.

◆ fgCurFontIdx

Int_t TTF::fgCurFontIdx = -1
staticprotected

current font index

Definition at line 78 of file TTF.h.

◆ fgFace

FT_Face TTF::fgFace
staticprotected

font face

Definition at line 82 of file TTF.h.

◆ fgFontCount

Int_t TTF::fgFontCount = 0
staticprotected

number of fonts loaded

Definition at line 80 of file TTF.h.

◆ fgFontName

char * TTF::fgFontName
staticprotected

font name

Definition at line 81 of file TTF.h.

◆ fgGlyphs

TTF::TTGlyph TTF::fgGlyphs
staticprotected

glyphs

Definition at line 83 of file TTF.h.

◆ fgHinting

Bool_t TTF::fgHinting = kFALSE
staticprotected

use hinting (true by default)

Definition at line 84 of file TTF.h.

◆ fgInit

Bool_t TTF::fgInit = kFALSE
staticprotected

true if the Init has been called

Definition at line 85 of file TTF.h.

◆ fgKerning

Bool_t TTF::fgKerning = kTRUE
staticprotected

use kerning (true by default)

Definition at line 86 of file TTF.h.

◆ fgLibrary

FT_Library TTF::fgLibrary
staticprotected

FreeType font library.

Definition at line 87 of file TTF.h.

◆ fgNumGlyphs

Int_t TTF::fgNumGlyphs = 0
staticprotected

number of glyphs in the string

Definition at line 88 of file TTF.h.

◆ fgRotMatrix

FT_Matrix * TTF::fgRotMatrix = nullptr
staticprotected

rotation matrix

Definition at line 89 of file TTF.h.

◆ fgSmoothing

Bool_t TTF::fgSmoothing = kTRUE
staticprotected

use anti-aliasing (true when >8 planes, false otherwise)

Definition at line 90 of file TTF.h.

◆ fgSymbItaFontIdx

Int_t TTF::fgSymbItaFontIdx = -1
staticprotected

Symbol italic font index.

Definition at line 79 of file TTF.h.

◆ fgTBlankW

Int_t TTF::fgTBlankW = 0
staticprotected

trailing blanks width

Definition at line 91 of file TTF.h.

◆ fgWidth

Int_t TTF::fgWidth = 0
staticprotected

string width, used to compute X alignment

Definition at line 92 of file TTF.h.

Libraries for TTF:

The documentation for this class was generated from the following files: