51 return (
name ==
"wingding.ttf") || (
name.find(
"symbol.ttf") == 0);
70 Error(
"TTF.cxx",
"error initializing FreeType");
110 Int_t n = face->num_charmaps;
111 for (
Int_t i = 0; i <
n; i++) {
112 FT_CharMap charmap = face->charmaps[i];
113 auto platform = charmap->platform_id;
114 auto encoding = charmap->encoding_id;
115 if ((
platform == 3 && encoding == 1) ||
121 Error(
"TTF::CharToUnicode",
"error in FT_Set_CharMap");
236 glyph.fImage =
nullptr;
248 fWidth += face->glyph->advance.x;
268 if (bbox.xMin <
xMin)
xMin = bbox.xMin;
269 if (bbox.yMin <
yMin)
yMin = bbox.yMin;
270 if (bbox.xMax >
xMax)
xMax = bbox.xMax;
271 if (bbox.yMax >
yMax)
yMax = bbox.yMax;
290 auto &
vect = *((std::vector<TTF::TTGlyph> *)
data);
292 for (std::size_t i = 0; i <
fGlyphs.size(); ++i) {
344 if (
w <= 0 ||
h <= 0)
429 const unsigned char *
p = (
const unsigned char*)
string;
458 const wchar_t *
p = string;
494#if defined(FREETYPE_PATCH) && \
495 (FREETYPE_MAJOR == 2) && (FREETYPE_MINOR == 1) && (FREETYPE_PATCH == 2)
517 thread_local std::map<std::string, FontStruct>
_fonts;
526 return fFont ? 0 : 1;
532 fFont = &iter->second;
542 for (
auto &font :
_fonts) {
543 if (font.second.face) {
545 font.second.face =
nullptr;
571 Fatal(
"SetTextFont",
"Fail to create font handle for font %s",
basename);
581 Error(
"SetTextFont",
"no free type library initialized");
636 {
"Root.TTFont.0",
"FreeSansBold.otf" },
637 {
"Root.TTFont.1",
"FreeSerifItalic.otf" },
638 {
"Root.TTFont.2",
"FreeSerifBold.otf" },
639 {
"Root.TTFont.3",
"FreeSerifBoldItalic.otf" },
640 {
"Root.TTFont.4",
"texgyreheros-regular.otf" },
641 {
"Root.TTFont.5",
"texgyreheros-italic.otf" },
642 {
"Root.TTFont.6",
"texgyreheros-bold.otf" },
643 {
"Root.TTFont.7",
"texgyreheros-bolditalic.otf" },
644 {
"Root.TTFont.8",
"FreeMono.otf" },
645 {
"Root.TTFont.9",
"FreeMonoOblique.otf" },
646 {
"Root.TTFont.10",
"FreeMonoBold.otf" },
647 {
"Root.TTFont.11",
"FreeMonoBoldOblique.otf" },
648 {
"Root.TTFont.12",
"symbol.ttf" },
649 {
"Root.TTFont.13",
"FreeSerif.otf" },
650 {
"Root.TTFont.14",
"wingding.ttf" },
651 {
"Root.TTFont.15",
"symbol.ttf" },
652 {
"Root.TTFont.STIXGen",
"STIXGeneral.otf" },
653 {
"Root.TTFont.STIXGenIt",
"STIXGeneralItalic.otf" },
654 {
"Root.TTFont.STIXGenBd",
"STIXGeneralBol.otf" },
655 {
"Root.TTFont.STIXGenBdIt",
"STIXGeneralBolIta.otf" },
656 {
"Root.TTFont.STIXSiz1Sym",
"STIXSiz1Sym.otf" },
657 {
"Root.TTFont.STIXSiz1SymBd",
"STIXSiz1SymBol.otf" },
658 {
"Root.TTFont.STIXSiz2Sym",
"STIXSiz2Sym.otf" },
659 {
"Root.TTFont.STIXSiz2SymBd",
"STIXSiz2SymBol.otf" },
660 {
"Root.TTFont.STIXSiz3Sym",
"STIXSiz3Sym.otf" },
661 {
"Root.TTFont.STIXSiz3SymBd",
"STIXSiz3SymBol.otf" },
662 {
"Root.TTFont.STIXSiz4Sym",
"STIXSiz4Sym.otf" },
663 {
"Root.TTFont.STIXSiz4SymBd",
"STIXSiz4SymBol.otf" },
664 {
"Root.TTFont.STIXSiz5Sym",
"STIXSiz5Sym.otf" },
665 {
"Root.TTFont.ME",
"DroidSansFallback.ttf" },
666 {
"Root.TTFont.CJKMing",
"DroidSansFallback.ttf" },
667 {
"Root.TTFont.CJKGothic",
"DroidSansFallback.ttf" }
703 Error(
"TTFhandle::SetTextSize",
"current font not selected");
711 Error(
"TTFhandle::SetTextSize",
"error in FT_Set_Char_Size: 0x%x (input size %f, calc. size 0x%x)",
err,
textsize,
tsize);
int Int_t
Signed integer 4 bytes (int)
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
float Float_t
Float 4 bytes (float)
short Font_t
Font number (short)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
void Fatal(const char *location, const char *msgfmt,...)
Use this function in case of a fatal error. It will abort the program.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t fontnumber
Option_t Option_t TPoint TPoint const char x1
Option_t Option_t SetTextFont
Option_t Option_t textsize
Option_t Option_t TPoint TPoint angle
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char fontname
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char text
Option_t Option_t TPoint TPoint const char y1
R__EXTERN TSystem * gSystem
const_iterator begin() const
const_iterator end() const
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
static const TString & GetTTFFontDir()
Get the fonts directory in the installation. Static utility function.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
virtual const char * FindFile(const char *search, TString &file, EAccessMode mode=kFileExists)
Find location of file in a search path.
virtual const char * BaseName(const char *pathname)
Base name of a file name. Base name of /user/root is root.
void GetTextExtent(UInt_t &w, UInt_t &h, const char *text)
Get width (w) and height (h) when text is horizontal.
Bool_t fKerning
use kerning (true by default)
void * GetFontFace() const
Return current font index.
Int_t fAscent
string ascent, used to compute Y alignment
Int_t SelectFontHandle(Int_t arg, const char *name=nullptr)
Return thread_local instance of FontStruct for speified font.
FontStruct * fFont
selected font
Bool_t SetTextSize(Float_t textsize)
Set current text size.
void SetRotationMatrix(Float_t angle)
Set the rotation matrix used to rotate the font outlines.
void PrepareString(const char *string)
Put the characters in "string" in the "glyphs" array.
UInt_t CharToUnicode(UInt_t code)
Map char to unicode. Returns 0 in case no mapping exists.
UInt_t GetNumGlyphs() const
return number of glyphs
Int_t GetGlyphsHeight() const
Returns height of all glyphs.
std::vector< GlyphStruct > fGlyphs
glyphs
long fRotationXY
rotation matrix members
void SetTextFont(Font_t fontnumber)
Set specified font.
Int_t fTBlankW
trailing blanks width
Int_t GetTrailingBlanksWidth() const
void Version(Int_t &major, Int_t &minor, Int_t &patch)
Int_t GetGlyphsWidth() const
Returns width of all glyphs.
static thread_local FT_Library_Wrapper fFT_Library
Bool_t fHinting
use hinting (false by default)
void CleanupGlyphs()
Remove temporary data created by LayoutGlyphs.
void LayoutGlyphs()
Compute the glyphs positions, fgAscent and fgWidth (needed for alignment).
void ComputeTrailingBlanksWidth(Int_t n)
Compute the trailing blanks width.
void GetTextAdvance(UInt_t &a, const char *text)
Get advance (a) when text is horizontal.
Int_t fWidth
string width, used to compute X alignment
void FillTTFGlypths(void *vect)
Fill vector from TTF class Only for backward compatibility of old API.
Bool_t GetSmoothing() const
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 fie...
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 wh...
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Thread-local wrapper to the freetype library.
FT_Library_Wrapper & operator=(FT_Library_Wrapper const &)=delete
FT_Library_Wrapper()=default
FT_Library_Wrapper & operator=(FT_Library_Wrapper &&)=delete
FT_Library_Wrapper(FT_Library_Wrapper &&)=delete
FT_Library_Wrapper(FT_Library_Wrapper const &)=delete
UInt_t fIndex
glyph index in face
FT_Glyph fImage
glyph image
FT_Vector fPos
position of glyph origin
GlyphStruct(UInt_t indx=0)