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

Dynamic handle to work with freetype 2 library.

in ROOT7 TTFhandle will be renamed into TTF class

Definition at line 119 of file TTF.h.

Public Member Functions

 TTFhandle ()
 
virtual ~TTFhandle ()
 
void CleanupGlyphs ()
 Remove temporary data created by LayoutGlyphs.
 
Int_t GetAscent () const
 
const FT_BBox & GetBox () const
 
FT_Face GetFontFace () const
 Return current font index.
 
FT_BitmapGlyph GetGlyphBitmap (UInt_t n, Bool_t smooth=kFALSE)
 Return bitmap for specified glyph.
 
TTF::TTGlyphGetGlyphs ()
 
Bool_t GetKerning () const
 
UInt_t GetNumGlyphs () const
 
FT_MatrixGetRotMatrix () 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 TClassIsA () 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 SetKerning (Bool_t state)
 
void SetRotationMatrix (Float_t angle)
 Set the rotation matrix used to rotate the font outlines.
 
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 TClassClass ()
 
static const char * Class_Name ()
 
static constexpr Version_t Class_Version ()
 
static const char * DeclFileName ()
 
static Bool_t GetHinting ()
 
static Bool_t GetSmoothing ()
 
static Bool_t Init ()
 
static void SetHinting (Bool_t state)
 
static void SetSmoothing (Bool_t state)
 

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.
 
Int_t SelectFontHandle (Int_t arg, const char *name=nullptr)
 Return thread_local instance of TTFontHandle for speified font.
 

Static Private Member Functions

static FT_Library InitClose (Int_t direction=0)
 Initialize or close FreeType library If argument is 0 - just return current handle Library initialized per thread.
 

Private Attributes

Int_t fAscent = 0
 string ascent, used to compute Y alignment
 
FT_BBox fCBox
 string control box
 
TTFontHandlefFont = nullptr
 selected font
 
std::vector< TTF::TTGlyphfGlyphs
 glyphs
 
Bool_t fKerning = kTRUE
 use kerning (true by default)
 
std::unique_ptr< FT_MatrixfRotMatrix
 rotation matrix
 
Int_t fTBlankW = 0
 trailing blanks width
 
Int_t fWidth = 0
 string width, used to compute X alignment
 

Static Private Attributes

static Bool_t fgHinting = kFALSE
 use hinting (false by default)
 
static Bool_t fgSmoothing = kTRUE
 use anti-aliasing (true when >8 planes, false otherwise)
 

Friends

class TTF
 

#include <TTF.h>

Constructor & Destructor Documentation

◆ TTFhandle()

TTFhandle::TTFhandle ( )

Definition at line 51 of file TTF.cxx.

◆ ~TTFhandle()

TTFhandle::~TTFhandle ( )
virtual

Definition at line 59 of file TTF.cxx.

Member Function Documentation

◆ CharToUnicode()

UInt_t TTFhandle::CharToUnicode ( UInt_t code)
private

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

Definition at line 89 of file TTF.cxx.

◆ Class()

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

◆ Class_Name()

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

◆ Class_Version()

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

Definition at line 180 of file TTF.h.

◆ CleanupGlyphs()

void TTFhandle::CleanupGlyphs ( )

Remove temporary data created by LayoutGlyphs.

Definition at line 273 of file TTF.cxx.

◆ ComputeTrailingBlanksWidth()

void TTFhandle::ComputeTrailingBlanksWidth ( Int_t n)
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 119 of file TTF.cxx.

◆ DeclFileName()

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

Definition at line 180 of file TTF.h.

◆ GetAscent()

Int_t TTFhandle::GetAscent ( ) const
inline

Definition at line 150 of file TTF.h.

◆ GetBox()

const FT_BBox & TTFhandle::GetBox ( ) const
inline

Definition at line 155 of file TTF.h.

◆ GetFontFace()

FT_Face TTFhandle::GetFontFace ( ) const

Return current font index.

Definition at line 344 of file TTF.cxx.

◆ GetGlyphBitmap()

FT_BitmapGlyph TTFhandle::GetGlyphBitmap ( UInt_t n,
Bool_t smooth = kFALSE )

Return bitmap for specified glyph.

Definition at line 259 of file TTF.cxx.

◆ GetGlyphs()

TTF::TTGlyph * TTFhandle::GetGlyphs ( )
inline

Definition at line 146 of file TTF.h.

◆ GetHinting()

Bool_t TTFhandle::GetHinting ( )
static

Definition at line 595 of file TTF.cxx.

◆ GetKerning()

Bool_t TTFhandle::GetKerning ( ) const
inline

Definition at line 151 of file TTF.h.

◆ GetNumGlyphs()

UInt_t TTFhandle::GetNumGlyphs ( ) const
inline

Definition at line 147 of file TTF.h.

◆ GetRotMatrix()

FT_Matrix * TTFhandle::GetRotMatrix ( ) const
inline

Definition at line 152 of file TTF.h.

◆ GetSmoothing()

Bool_t TTFhandle::GetSmoothing ( )
static

Definition at line 602 of file TTF.cxx.

◆ GetTextAdvance()

void TTFhandle::GetTextAdvance ( UInt_t & a,
const char * text )

Get advance (a) when text is horizontal.

Definition at line 155 of file TTF.cxx.

◆ GetTextExtent() [1/2]

void TTFhandle::GetTextExtent ( UInt_t & w,
UInt_t & h,
const char * text )

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

Definition at line 140 of file TTF.cxx.

◆ GetTextExtent() [2/2]

void TTFhandle::GetTextExtent ( UInt_t & w,
UInt_t & h,
const wchar_t * text )

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

Definition at line 167 of file TTF.cxx.

◆ GetTrailingBlanksWidth()

Int_t TTFhandle::GetTrailingBlanksWidth ( ) const
inline

Definition at line 153 of file TTF.h.

◆ GetWidth()

Int_t TTFhandle::GetWidth ( ) const
inline

Definition at line 154 of file TTF.h.

◆ Init()

Bool_t TTFhandle::Init ( )
static

Definition at line 587 of file TTF.cxx.

◆ InitClose()

FT_Library TTFhandle::InitClose ( Int_t direction = 0)
staticprivate

Initialize or close FreeType library If argument is 0 - just return current handle Library initialized per thread.

Definition at line 69 of file TTF.cxx.

◆ IsA()

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

Definition at line 180 of file TTF.h.

◆ LayoutGlyphs()

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

◆ PrepareString() [1/2]

void TTFhandle::PrepareString ( const char * string)

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

Definition at line 290 of file TTF.cxx.

◆ PrepareString() [2/2]

void TTFhandle::PrepareString ( const wchar_t * string)

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

Definition at line 315 of file TTF.cxx.

◆ SelectFontHandle()

Int_t TTFhandle::SelectFontHandle ( Int_t arg,
const char * name = nullptr )
private

Return thread_local instance of TTFontHandle for speified font.

Definition at line 376 of file TTF.cxx.

◆ SetHinting()

void TTFhandle::SetHinting ( Bool_t state)
static

Definition at line 609 of file TTF.cxx.

◆ SetKerning()

void TTFhandle::SetKerning ( Bool_t state)
inline

Definition at line 157 of file TTF.h.

◆ SetRotationMatrix()

void TTFhandle::SetRotationMatrix ( Float_t angle)

Set the rotation matrix used to rotate the font outlines.

Definition at line 352 of file TTF.cxx.

◆ SetSmoothing()

void TTFhandle::SetSmoothing ( Bool_t state)
static

Definition at line 616 of file TTF.cxx.

◆ SetTextFont() [1/2]

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

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

◆ SetTextFont() [2/2]

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

◆ SetTextSize()

Bool_t TTFhandle::SetTextSize ( Float_t textsize)

Set current text size.

Definition at line 558 of file TTF.cxx.

◆ Streamer()

virtual void TTFhandle::Streamer ( TBuffer & )
virtual

◆ StreamerNVirtual()

void TTFhandle::StreamerNVirtual ( TBuffer & ClassDef_StreamerNVirtual_b)
inline

Definition at line 180 of file TTF.h.

◆ Version()

void TTFhandle::Version ( Int_t & major,
Int_t & minor,
Int_t & patch )

Definition at line 579 of file TTF.cxx.

Friends And Related Symbol Documentation

◆ TTF

friend class TTF
friend

Definition at line 120 of file TTF.h.

Member Data Documentation

◆ fAscent

Int_t TTFhandle::fAscent = 0
private

string ascent, used to compute Y alignment

Definition at line 124 of file TTF.h.

◆ fCBox

FT_BBox TTFhandle::fCBox
private

string control box

Definition at line 125 of file TTF.h.

◆ fFont

TTFontHandle* TTFhandle::fFont = nullptr
private

selected font

Definition at line 123 of file TTF.h.

◆ fgHinting

Bool_t TTFhandle::fgHinting = kFALSE
staticprivate

use hinting (false by default)

Definition at line 132 of file TTF.h.

◆ fGlyphs

std::vector<TTF::TTGlyph> TTFhandle::fGlyphs
private

glyphs

Definition at line 126 of file TTF.h.

◆ fgSmoothing

Bool_t TTFhandle::fgSmoothing = kTRUE
staticprivate

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

Definition at line 133 of file TTF.h.

◆ fKerning

Bool_t TTFhandle::fKerning = kTRUE
private

use kerning (true by default)

Definition at line 127 of file TTF.h.

◆ fRotMatrix

std::unique_ptr<FT_Matrix> TTFhandle::fRotMatrix
private

rotation matrix

Definition at line 128 of file TTF.h.

◆ fTBlankW

Int_t TTFhandle::fTBlankW = 0
private

trailing blanks width

Definition at line 129 of file TTF.h.

◆ fWidth

Int_t TTFhandle::fWidth = 0
private

string width, used to compute X alignment

Definition at line 130 of file TTF.h.

Libraries for TTFhandle:

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