diff -ur root-6.28.00.orig/core/base/src/TApplication.cxx root-6.28.00/core/base/src/TApplication.cxx --- root-6.28.00.orig/core/base/src/TApplication.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/core/base/src/TApplication.cxx 2023-02-04 12:47:19.757759982 +0100 @@ -251,18 +251,11 @@ LoadGraphicsLibs(); // Try to load TrueType font renderer. Only try to load if not in batch - // mode and Root.UseTTFonts is true and Root.TTFontPath exists. Abort silently + // mode and Root.UseTTFonts is true. Abort silently // if libttf or libGX11TTF are not found in $ROOTSYS/lib or $ROOTSYS/ttf/lib. - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *ttfont = gSystem->Which(ttpath, "arialbd.ttf", kReadPermission); - // Check for use of DFSG - fonts - if (!ttfont) - ttfont = gSystem->Which(ttpath, "FreeSansBold.ttf", kReadPermission); - #if !defined(R__WIN32) if (!gROOT->IsBatch() && !strcmp(gVirtualX->GetName(), "X11") && - ttfont && gEnv->GetValue("Root.UseTTFonts", 1)) { + gEnv->GetValue("Root.UseTTFonts", 1)) { if (gClassTable->GetDict("TGX11TTF")) { // in principle we should not have linked anything against libGX11TTF // but with ACLiC this can happen, initialize TGX11TTF by hand @@ -276,7 +269,6 @@ } } #endif - delete [] ttfont; } if (!only_web || !fAppImp) { diff -ur root-6.28.00.orig/graf2d/asimage/CMakeLists.txt root-6.28.00/graf2d/asimage/CMakeLists.txt --- root-6.28.00.orig/graf2d/asimage/CMakeLists.txt 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/asimage/CMakeLists.txt 2023-02-04 12:47:19.757759982 +0100 @@ -30,6 +30,7 @@ ${FREETYPE_LIBRARIES} ${X11_LIBRARIES} ZLIB::ZLIB + fontconfig DEPENDENCIES Core Graf diff -ur root-6.28.00.orig/graf2d/asimage/src/TASImage.cxx root-6.28.00/graf2d/asimage/src/TASImage.cxx --- root-6.28.00.orig/graf2d/asimage/src/TASImage.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/asimage/src/TASImage.cxx 2023-02-04 12:47:19.760759989 +0100 @@ -115,6 +115,8 @@ # include } +#include + // auxiliary functions for general polygon filling #include "TASPolyUtils.c" @@ -2590,14 +2592,120 @@ TString fn = font_name; fn.Strip(); - // This is for backward compatibility... - if (fn.Last('/') == 0) fn = fn(1, fn.Length() - 1); + const char *basename = gSystem->BaseName(fn); + + char *ttfnt = NULL; + int ttindex = 0; + + FcPattern *pat, *match; + FcResult result; + + pat = FcPatternCreate (); + + if (strcmp(basename, "timesi.ttf") == 0 || + strcmp(basename, "FreeSerifItalic.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "timesbd.ttf") == 0 || + strcmp(basename, "FreeSerifBold.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "timesbi.ttf") == 0 || + strcmp(basename, "FreeSerifBoldItalic.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "arial.ttf") == 0 || + strcmp(basename, "FreeSans.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "ariali.ttf") == 0 || + strcmp(basename, "FreeSansOblique.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "arialbd.ttf") == 0 || + strcmp(basename, "FreeSansBold.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "arialbi.ttf") == 0 || + strcmp(basename, "FreeSansBoldOblique.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "cour.ttf") == 0 || + strcmp(basename, "FreeMono.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "couri.ttf") == 0 || + strcmp(basename, "FreeMonoOblique.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "courbd.ttf") == 0 || + strcmp(basename, "FreeMonoBold.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "courbi.ttf") == 0 || + strcmp(basename, "FreeMonoBoldOblique.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else if (strcmp(basename, "symbol.ttf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"symbol"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "times.ttf") == 0 || + strcmp(basename, "FreeSerif.otf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "wingding.ttf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"dingbats"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + else if (strcmp(basename, "BlackChancery.ttf") == 0) { + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"urwchanceryl"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + } + else { + Warning("DrawText", "cannot find a font %s", font_name); + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + } + + FcConfigSubstitute (NULL, pat, FcMatchPattern); + FcDefaultSubstitute (pat); + match = FcFontMatch (NULL, pat, &result); + FcPatternGetString (match, FC_FILE, 0, (FcChar8**)&ttfnt); + FcPatternGetInteger (match, FC_INDEX, 0, &ttindex); - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *tmpstr = gSystem->Which(ttpath, fn, kReadPermission); - fn = tmpstr; - delete [] tmpstr; + fn = ttfnt; + + FcPatternDestroy (match); + FcPatternDestroy (pat); if (fn.EndsWith(".pfa") || fn.EndsWith(".PFA") || fn.EndsWith(".pfb") || fn.EndsWith(".PFB") || fn.EndsWith(".ttf") || fn.EndsWith(".TTF") || fn.EndsWith(".otf") || fn.EndsWith(".OTF")) { ttfont = kTRUE; @@ -2621,14 +2729,11 @@ return; } - ASFont *font = get_asfont(gFontManager, fn.Data(), 0, size, ASF_GuessWho); + ASFont *font = get_asfont(gFontManager, fn.Data(), ttindex, size, ASF_GuessWho); if (!font) { - font = get_asfont(gFontManager, "fixed", 0, size, ASF_GuessWho); - if (!font) { - Warning("DrawText", "cannot find a font %s", font_name); - return; - } + Warning("DrawText", "cannot find a font %s", font_name); + return; } get_text_size(text, font, (ASText3DType)type, &width, &height); diff -ur root-6.28.00.orig/graf2d/graf/CMakeLists.txt root-6.28.00/graf2d/graf/CMakeLists.txt --- root-6.28.00.orig/graf2d/graf/CMakeLists.txt 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/graf/CMakeLists.txt 2023-02-04 12:47:19.861760233 +0100 @@ -91,6 +91,7 @@ ${FREETYPE_LIBRARIES} ZLIB::ZLIB mathtext + fontconfig DEPENDENCIES Hist Matrix diff -ur root-6.28.00.orig/graf2d/graf/inc/TTF.h root-6.28.00/graf2d/graf/inc/TTF.h --- root-6.28.00.orig/graf2d/graf/inc/TTF.h 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/graf/inc/TTF.h 2023-02-04 12:47:19.862760235 +0100 @@ -76,9 +76,8 @@ static FT_BBox fgCBox; ///< string control box static FT_CharMap fgCharMap[kTTMaxFonts]; ///< font character map static Int_t fgCurFontIdx; ///< current font index - static Int_t fgSymbItaFontIdx; ///< Symbol italic font index static Int_t fgFontCount; ///< number of fonts loaded - static char *fgFontName[kTTMaxFonts]; ///< font name + static Int_t fgFontID[kTTMaxFonts]; ///< font ID static FT_Face fgFace[kTTMaxFonts]; ///< font face static TTF::TTGlyph fgGlyphs[kMaxGlyphs]; ///< glyphs static Bool_t fgHinting; ///< use hinting (true by default) diff -ur root-6.28.00.orig/graf2d/graf/src/TTF.cxx root-6.28.00/graf2d/graf/src/TTF.cxx --- root-6.28.00.orig/graf2d/graf/src/TTF.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/graf/src/TTF.cxx 2023-02-04 12:47:19.863760238 +0100 @@ -25,6 +25,8 @@ #include "TMath.h" #include "TError.h" +#include + // to scale fonts to the same size as the old TT version const Float_t kScale = 0.93376068; @@ -38,10 +40,9 @@ Int_t TTF::fgWidth = 0; Int_t TTF::fgAscent = 0; Int_t TTF::fgCurFontIdx = -1; -Int_t TTF::fgSymbItaFontIdx = -1; Int_t TTF::fgFontCount = 0; Int_t TTF::fgNumGlyphs = 0; -char *TTF::fgFontName[kTTMaxFonts]; +Int_t TTF::fgFontID[kTTMaxFonts]; FT_Matrix *TTF::fgRotMatrix = nullptr; FT_Library TTF::fgLibrary; FT_BBox TTF::fgCBox; @@ -72,6 +73,11 @@ return; } + // Add root's font directory + const char *ttpath = gEnv->GetValue("Root.TTFontPath", + TROOT::GetTTFFontDir()); + FcConfigAppFontAddDir (NULL, (const FcChar8*)ttpath); + // load default font (arialbd) SetTextFont(62); } @@ -84,7 +90,6 @@ if (!fgInit) return; for (int i = 0; i < fgFontCount; i++) { - delete [] fgFontName[i]; FT_Done_Face(fgFace[i]); } if (fgRotMatrix) delete fgRotMatrix; @@ -109,12 +114,19 @@ charmap = fgFace[fgCurFontIdx]->charmaps[i]; platform = charmap->platform_id; encoding = charmap->encoding_id; - if ((platform == 3 && encoding == 1) || + if ((platform == 3 && encoding == 1 && + (fgFontID[fgCurFontIdx] != 12 && + fgFontID[fgCurFontIdx] != 14 && + fgFontID[fgCurFontIdx] != 15)) || (platform == 0 && encoding == 0) || + (platform == 7 && encoding == 2 && + (fgFontID[fgCurFontIdx] == 12 || + fgFontID[fgCurFontIdx] == 14 || + fgFontID[fgCurFontIdx] == 15)) || (platform == 1 && encoding == 0 && - !strcmp(fgFontName[fgCurFontIdx], "wingding.ttf")) || - (platform == 1 && encoding == 0 && - !strcmp(fgFontName[fgCurFontIdx], "symbol.ttf"))) + (fgFontID[fgCurFontIdx] == 12 || + fgFontID[fgCurFontIdx] == 14 || + fgFontID[fgCurFontIdx] == 15))) { fgCharMap[fgCurFontIdx] = charmap; if (FT_Set_Charmap(fgFace[fgCurFontIdx], fgCharMap[fgCurFontIdx])) @@ -381,27 +393,147 @@ if (!fontname || !fontname[0]) { Warning("TTF::SetTextFont", - "no font name specified, using default font %s", fgFontName[0]); + "no font name specified, using default font"); fgCurFontIdx = 0; return 0; } const char *basename = gSystem->BaseName(fontname); + if (strcmp(basename, "timesi.ttf") == 0 || + strcmp(basename, "FreeSerifItalic.otf") == 0) { + SetTextFont(12); + } + else if (strcmp(basename, "timesbd.ttf") == 0 || + strcmp(basename, "FreeSerifBold.otf") == 0) { + SetTextFont(22); + } + else if (strcmp(basename, "timesbi.ttf") == 0 || + strcmp(basename, "FreeSerifBoldItalic.otf") == 0) { + SetTextFont(32); + } + else if (strcmp(basename, "arial.ttf") == 0 || + strcmp(basename, "FreeSans.otf") == 0) { + SetTextFont(42); + } + else if (strcmp(basename, "ariali.ttf") == 0 || + strcmp(basename, "FreeSansOblique.otf") == 0) { + SetTextFont(52); + } + else if (strcmp(basename, "arialbd.ttf") == 0 || + strcmp(basename, "FreeSansBold.otf") == 0) { + SetTextFont(62); + } + else if (strcmp(basename, "arialbi.ttf") == 0 || + strcmp(basename, "FreeSansBoldOblique.otf") == 0) { + SetTextFont(72); + } + else if (strcmp(basename, "cour.ttf") == 0 || + strcmp(basename, "FreeMono.otf") == 0) { + SetTextFont(82); + } + else if (strcmp(basename, "couri.ttf") == 0 || + strcmp(basename, "FreeMonoOblique.otf") == 0) { + SetTextFont(92); + } + else if (strcmp(basename, "courbd.ttf") == 0 || + strcmp(basename, "FreeMonoBold.otf") == 0) { + SetTextFont(102); + } + else if (strcmp(basename, "courbi.ttf") == 0 || + strcmp(basename, "FreeMonoBoldOblique.otf") == 0) { + SetTextFont(112); + } + else if (strcmp(basename, "symbol.ttf") == 0) { + if (italic) + SetTextFont(152); + else + SetTextFont(122); + } + else if (strcmp(basename, "times.ttf") == 0 || + strcmp(basename, "FreeSerif.otf") == 0) { + SetTextFont(132); + } + else if (strcmp(basename, "wingding.ttf") == 0) { + SetTextFont(142); + } + else if (strcmp(basename, "STIXGeneral.otf") == 0) { + SetTextFont(162); + } + else if (strcmp(basename, "STIXGeneralItalic.otf") == 0) { + SetTextFont(172); + } + else if (strcmp(basename, "STIXGeneralBol.otf") == 0) { + SetTextFont(182); + } + else if (strcmp(basename, "STIXGeneralBolIta.otf") == 0) { + SetTextFont(192); + } + else if (strcmp(basename, "STIXSiz1Sym.otf") == 0) { + SetTextFont(202); + } + else if (strcmp(basename, "STIXSiz1SymBol.otf") == 0) { + SetTextFont(212); + } + else if (strcmp(basename, "STIXSiz2Sym.otf") == 0) { + SetTextFont(222); + } + else if (strcmp(basename, "STIXSiz2SymBol.otf") == 0) { + SetTextFont(232); + } + else if (strcmp(basename, "STIXSiz3Sym.otf") == 0) { + SetTextFont(242); + } + else if (strcmp(basename, "STIXSiz3SymBol.otf") == 0) { + SetTextFont(252); + } + else if (strcmp(basename, "STIXSiz4Sym.otf") == 0) { + SetTextFont(262); + } + else if (strcmp(basename, "STIXSiz4SymBol.otf") == 0) { + SetTextFont(272); + } + else if (strcmp(basename, "STIXSiz5Sym.otf") == 0) { + SetTextFont(282); + } + else if (strcmp(basename, "DroidSansFallback.ttf") == 0) { + SetTextFont(292); + } + else { + Error("TTF::SetTextFont", "font %s not known to ROOT", basename); + if (fgFontCount) { + Warning("TTF::SetTextFont", "using default font"); + fgCurFontIdx = 0; // use font 0 (default font, set in ctor) + return 0; + } else { + return 1; + } + } + + return 0; +} + +//______________________________________________________________________________ +void TTF::SetTextFont(Font_t fontnumber) +{ + int fontid = fontnumber / 10; + if (fontid < 0 || fontid > 31) fontid = 0; + + Int_t italic = 0; + if (fontid==15) italic = 1; + + if (!fgInit) Init(); + + if (fontid == 0) { + fgCurFontIdx = 0; // use font 0 (default font, set in ctor) + return; + } + // check if font is in cache int i; for (i = 0; i < fgFontCount; i++) { - if (!strcmp(fgFontName[i], basename)) { - if (italic) { - if (i==fgSymbItaFontIdx) { - fgCurFontIdx = i; - return 0; - } - } else { - if (i!=fgSymbItaFontIdx) { - fgCurFontIdx = i; - return 0; - } - } + if (fgFontID[i] == fontid) { + fgCurFontIdx = i; + return; } } @@ -409,151 +541,215 @@ if (fgFontCount >= kTTMaxFonts) { Error("TTF::SetTextFont", "too many fonts opened (increase kTTMaxFont = %d)", kTTMaxFonts); - Warning("TTF::SetTextFont", "using default font %s", fgFontName[0]); + Warning("TTF::SetTextFont", "using default font"); fgCurFontIdx = 0; // use font 0 (default font, set in ctor) - return 0; + return; } - // try to load font (font must be in Root.TTFontPath resource) - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *ttfont = gSystem->Which(ttpath, fontname, kReadPermission); + char *ttfont = NULL; + int ttindex = 0; - if (!ttfont) { - Error("TTF::SetTextFont", "font file %s not found in path", fontname); - if (fgFontCount) { - Warning("TTF::SetTextFont", "using default font %s", fgFontName[0]); - fgCurFontIdx = 0; // use font 0 (default font, set in ctor) - return 0; - } else { - return 1; - } + FcPattern *pat, *match; + FcCharSet *set = NULL; + FcResult result; + + pat = FcPatternCreate (); + + switch (fontid) { + case 1: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 2: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 3: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 4: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 5: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 6: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 7: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 8: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 9: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 10: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 11: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 12: + case 15: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"symbol"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 13: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 14: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"dingbats"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 16: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 17: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 18: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 19: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 20: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 21: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 22: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 23: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 24: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 25: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 26: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 27: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 28: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize5"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 29: + case 30: + case 31: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"droidsansfallback"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + set = FcCharSetCreate (); + FcCharSetAddChar (set, 0x0410); // Cyrillic + FcCharSetAddChar (set, 0x4e00); // CJK + FcPatternAddCharSet (pat, FC_CHARSET, set); + break; + default: + Error("TTF::SetTextFont", "font %i not known to ROOT", fontid); + FcPatternDestroy (pat); + Warning("TTF::SetTextFont", "using default font"); + fgCurFontIdx = 0; // use font 0 (default font, set in ctor) + return; + break; } + FcConfigSubstitute (NULL, pat, FcMatchPattern); + FcDefaultSubstitute (pat); + match = FcFontMatch (NULL, pat, &result); + char *ttfnt; + FcPatternGetString (match, FC_FILE, 0, (FcChar8**)&ttfnt); + ttfont = StrDup (ttfnt); + FcPatternGetInteger (match, FC_INDEX, 0, &ttindex); + FcPatternDestroy (match); + FcPatternDestroy (pat); + if (set) FcCharSetDestroy (set); + FT_Face tface = (FT_Face) 0; - if (FT_New_Face(fgLibrary, ttfont, 0, &tface)) { + if (FT_New_Face(fgLibrary, ttfont, ttindex, &tface)) { Error("TTF::SetTextFont", "error loading font %s", ttfont); delete [] ttfont; if (tface) FT_Done_Face(tface); - if (fgFontCount) { - Warning("TTF::SetTextFont", "using default font %s", fgFontName[0]); - fgCurFontIdx = 0; - return 0; - } else { - return 1; - } + Warning("TTF::SetTextFont", "using default font"); + fgCurFontIdx = 0; + return; } delete [] ttfont; - fgFontName[fgFontCount] = StrDup(basename); + fgFontID[fgFontCount] = fontid; fgCurFontIdx = fgFontCount; fgFace[fgCurFontIdx] = tface; fgCharMap[fgCurFontIdx] = (FT_CharMap) 0; fgFontCount++; if (italic) { - fgSymbItaFontIdx = fgCurFontIdx; FT_Matrix slantMat; slantMat.xx = (1 << 16); slantMat.xy = ((1 << 16) >> 2); slantMat.yx = 0; slantMat.yy = (1 << 16); - FT_Set_Transform( fgFace[fgSymbItaFontIdx], &slantMat, NULL ); - } - - return 0; -} - -//////////////////////////////////////////////////////////////////////////////// -/// Set specified font. -/// List of the currently supported fonts (screen and PostScript) -/// -/// | Font ID | X11 | TTF | -/// |---------|---------------------------|------------------| -/// | 1 | times-medium-i-normal | timesi.ttf | -/// | 2 | times-bold-r-normal | timesbd.ttf | -/// | 3 | times-bold-i-normal | timesbi.ttf | -/// | 4 | helvetica-medium-r-normal | arial.ttf | -/// | 5 | helvetica-medium-o-normal | ariali.ttf | -/// | 6 | helvetica-bold-r-normal | arialbd.ttf | -/// | 7 | helvetica-bold-o-normal | arialbi.ttf | -/// | 8 | courier-medium-r-normal | cour.ttf | -/// | 9 | courier-medium-o-normal | couri.ttf | -/// | 10 | courier-bold-r-normal | courbd.ttf | -/// | 11 | courier-bold-o-normal | courbi.ttf | -/// | 12 | symbol-medium-r-normal | symbol.ttf | -/// | 13 | times-medium-r-normal | times.ttf | -/// | 14 | | wingding.ttf | -/// | 15 | symbol oblique is emulated from symbol.ttf | | - -void TTF::SetTextFont(Font_t fontnumber) -{ - // Added by cholm for use of DFSG - fonts - based on Kevins fix. - // Table of Microsoft and (for non-MSFT operating systems) backup - // FreeFont TTF fonts. - static const char *fonttable[][2] = { - { "Root.TTFont.0", "FreeSansBold.otf" }, - { "Root.TTFont.1", "FreeSerifItalic.otf" }, - { "Root.TTFont.2", "FreeSerifBold.otf" }, - { "Root.TTFont.3", "FreeSerifBoldItalic.otf" }, - { "Root.TTFont.4", "FreeSans.otf" }, - { "Root.TTFont.5", "FreeSansOblique.otf" }, - { "Root.TTFont.6", "FreeSansBold.otf" }, - { "Root.TTFont.7", "FreeSansBoldOblique.otf" }, - { "Root.TTFont.8", "FreeMono.otf" }, - { "Root.TTFont.9", "FreeMonoOblique.otf" }, - { "Root.TTFont.10", "FreeMonoBold.otf" }, - { "Root.TTFont.11", "FreeMonoBoldOblique.otf" }, - { "Root.TTFont.12", "symbol.ttf" }, - { "Root.TTFont.13", "FreeSerif.otf" }, - { "Root.TTFont.14", "wingding.ttf" }, - { "Root.TTFont.15", "symbol.ttf" }, - { "Root.TTFont.STIXGen", "STIXGeneral.otf" }, - { "Root.TTFont.STIXGenIt", "STIXGeneralItalic.otf" }, - { "Root.TTFont.STIXGenBd", "STIXGeneralBol.otf" }, - { "Root.TTFont.STIXGenBdIt", "STIXGeneralBolIta.otf" }, - { "Root.TTFont.STIXSiz1Sym", "STIXSiz1Sym.otf" }, - { "Root.TTFont.STIXSiz1SymBd", "STIXSiz1SymBol.otf" }, - { "Root.TTFont.STIXSiz2Sym", "STIXSiz2Sym.otf" }, - { "Root.TTFont.STIXSiz2SymBd", "STIXSiz2SymBol.otf" }, - { "Root.TTFont.STIXSiz3Sym", "STIXSiz3Sym.otf" }, - { "Root.TTFont.STIXSiz3SymBd", "STIXSiz3SymBol.otf" }, - { "Root.TTFont.STIXSiz4Sym", "STIXSiz4Sym.otf" }, - { "Root.TTFont.STIXSiz4SymBd", "STIXSiz4SymBol.otf" }, - { "Root.TTFont.STIXSiz5Sym", "STIXSiz5Sym.otf" }, - { "Root.TTFont.ME", "DroidSansFallback.ttf" }, - { "Root.TTFont.CJKMing", "DroidSansFallback.ttf" }, - { "Root.TTFont.CJKGothic", "DroidSansFallback.ttf" } - }; - - static int fontset = -1; - int thisset = fontset; - - int fontid = fontnumber / 10; - if (fontid < 0 || fontid > 31) fontid = 0; - - if (thisset == -1) { - // try to load font (font must be in Root.TTFontPath resource) - // to see which fontset we have available - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *ttfont = gSystem->Which(ttpath, gEnv->GetValue(fonttable[fontid][0], fonttable[fontid][1]), kReadPermission); - if (ttfont) { - delete [] ttfont; - thisset = 0; - } else { - // try backup free font - thisset = 1; - } + FT_Set_Transform( fgFace[fgCurFontIdx], &slantMat, NULL ); } - Int_t italic = 0; - if (fontid==15) italic = 1; - int ret = SetTextFont(gEnv->GetValue(fonttable[fontid][thisset], fonttable[fontid][1]), italic); - // Do not define font set is we're loading the symbol.ttf - it's - // the same in both cases. - if (ret == 0 && fontid != 12) fontset = thisset; } //////////////////////////////////////////////////////////////////////////////// diff -ur root-6.28.00.orig/graf2d/postscript/CMakeLists.txt root-6.28.00/graf2d/postscript/CMakeLists.txt --- root-6.28.00.orig/graf2d/postscript/CMakeLists.txt 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/postscript/CMakeLists.txt 2023-02-04 12:47:19.863760238 +0100 @@ -27,6 +27,7 @@ LIBRARIES ZLIB::ZLIB mathtext + fontconfig DEPENDENCIES Graf ) diff -ur root-6.28.00.orig/graf2d/postscript/src/TPostScript.cxx root-6.28.00/graf2d/postscript/src/TPostScript.cxx --- root-6.28.00.orig/graf2d/postscript/src/TPostScript.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf2d/postscript/src/TPostScript.cxx 2023-02-04 12:47:19.864760240 +0100 @@ -234,6 +234,7 @@ #include #include #include +#include #include "strlcpy.h" #include "snprintf.h" @@ -1585,56 +1586,179 @@ void TPostScript::FontEmbed(void) { - static const char *fonttable[32][2] = { - { "Root.TTFont.0", "FreeSansBold.otf" }, - { "Root.TTFont.1", "FreeSerifItalic.otf" }, - { "Root.TTFont.2", "FreeSerifBold.otf" }, - { "Root.TTFont.3", "FreeSerifBoldItalic.otf" }, - { "Root.TTFont.4", "FreeSans.otf" }, - { "Root.TTFont.5", "FreeSansOblique.otf" }, - { "Root.TTFont.6", "FreeSansBold.otf" }, - { "Root.TTFont.7", "FreeSansBoldOblique.otf" }, - { "Root.TTFont.8", "FreeMono.otf" }, - { "Root.TTFont.9", "FreeMonoOblique.otf" }, - { "Root.TTFont.10", "FreeMonoBold.otf" }, - { "Root.TTFont.11", "FreeMonoBoldOblique.otf" }, - { "Root.TTFont.12", "symbol.ttf" }, - { "Root.TTFont.13", "FreeSerif.otf" }, - { "Root.TTFont.14", "wingding.ttf" }, - { "Root.TTFont.15", "symbol.ttf" }, - { "Root.TTFont.STIXGen", "STIXGeneral.otf" }, - { "Root.TTFont.STIXGenIt", "STIXGeneralItalic.otf" }, - { "Root.TTFont.STIXGenBd", "STIXGeneralBol.otf" }, - { "Root.TTFont.STIXGenBdIt", "STIXGeneralBolIta.otf" }, - { "Root.TTFont.STIXSiz1Sym", "STIXSiz1Sym.otf" }, - { "Root.TTFont.STIXSiz1SymBd", "STIXSiz1SymBol.otf" }, - { "Root.TTFont.STIXSiz2Sym", "STIXSiz2Sym.otf" }, - { "Root.TTFont.STIXSiz2SymBd", "STIXSiz2SymBol.otf" }, - { "Root.TTFont.STIXSiz3Sym", "STIXSiz3Sym.otf" }, - { "Root.TTFont.STIXSiz3SymBd", "STIXSiz3SymBol.otf" }, - { "Root.TTFont.STIXSiz4Sym", "STIXSiz4Sym.otf" }, - { "Root.TTFont.STIXSiz4SymBd", "STIXSiz4SymBol.otf" }, - { "Root.TTFont.STIXSiz5Sym", "STIXSiz5Sym.otf" }, - { "Root.TTFont.ME", "DroidSansFallback.ttf" }, - { "Root.TTFont.CJKMing", "DroidSansFallback.ttf" }, - { "Root.TTFont.CJKCothic", "DroidSansFallback.ttf" } - }; - PrintStr("%%IncludeResource: ProcSet (FontSetInit)@"); - // try to load font (font must be in Root.TTFontPath resource) - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - for (Int_t fontid = 1; fontid < 30; fontid++) { if (fontid != 15 && MustEmbed[fontid-1]) { - const char *filename = gEnv->GetValue( - fonttable[fontid][0], fonttable[fontid][1]); - char *ttfont = gSystem->Which(ttpath, filename, kReadPermission); + + char *ttfont = NULL; + + FcPattern *pat, *match; + FcCharSet *set = NULL; + FcResult result; + + pat = FcPatternCreate (); + + switch (fontid) { + case 1: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 2: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 3: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 4: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 5: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 6: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 7: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 8: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 9: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 10: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 11: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 12: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"symbol"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 13: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 14: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"dingbats"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 16: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 17: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 18: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 19: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 20: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 21: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 22: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 23: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 24: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 25: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 26: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 27: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 28: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize5"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 29: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"droidsansfallback"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + set = FcCharSetCreate (); + FcCharSetAddChar (set, 0x0410); // Cyrillic + FcCharSetAddChar (set, 0x4e00); // CJK + FcPatternAddCharSet (pat, FC_CHARSET, set); + break; + } + + FcConfigSubstitute (NULL, pat, FcMatchPattern); + FcDefaultSubstitute (pat); + match = FcFontMatch (NULL, pat, &result); + char *ttfnt; + FcPatternGetString (match, FC_FILE, 0, (FcChar8**)&ttfnt); + ttfont = StrDup(ttfnt); + FcPatternDestroy (match); + FcPatternDestroy (pat); + if (set) FcCharSetDestroy (set); + if (!ttfont) { - Error("TPostScript::FontEmbed", - "font %d (filename `%s') not found in path", - fontid, filename); + Error("TPostScript::FontEmbed", "font %d not found in path", + fontid); } else { if (FontEmbedType2(ttfont)) { // nothing @@ -1643,9 +1767,8 @@ } else if(FontEmbedType42(ttfont)) { // nothing } else { - Error("TPostScript::FontEmbed", - "failed to embed font %d (filename `%s')", - fontid, filename); + Error("TPostScript::FontEmbed", "failed to embed font %d)", + fontid); } delete [] ttfont; } @@ -2837,10 +2960,10 @@ { "Root.PSFont.9", "/FreeMonoOblique" }, { "Root.PSFont.10", "/FreeMonoBold" }, { "Root.PSFont.11", "/FreeMonoBoldOblique" }, - { "Root.PSFont.12", "/SymbolMT" }, + { "Root.PSFont.12", "/StandardSymbolsL" }, { "Root.PSFont.13", "/FreeSerif" }, - { "Root.PSFont.14", "/Wingdings-Regular" }, - { "Root.PSFont.15", "/SymbolMT" }, + { "Root.PSFont.14", "/Dingbats" }, + { "Root.PSFont.15", "/StandardSymbolsL" }, { "Root.PSFont.STIXGen", "/STIXGeneral" }, { "Root.PSFont.STIXGenIt", "/STIXGeneral-Italic" }, { "Root.PSFont.STIXGenBd", "/STIXGeneral-Bold" }, diff -ur root-6.28.00.orig/graf3d/gl/CMakeLists.txt root-6.28.00/graf3d/gl/CMakeLists.txt --- root-6.28.00.orig/graf3d/gl/CMakeLists.txt 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf3d/gl/CMakeLists.txt 2023-02-04 12:47:19.867760247 +0100 @@ -208,6 +208,7 @@ ${GL2PS_LIBRARIES} ${X11_LIBRARIES} RGlew + fontconfig DEPENDENCIES Hist Gui diff -ur root-6.28.00.orig/graf3d/gl/src/TGLFontManager.cxx root-6.28.00/graf3d/gl/src/TGLFontManager.cxx --- root-6.28.00.orig/graf3d/gl/src/TGLFontManager.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf3d/gl/src/TGLFontManager.cxx 2023-02-04 12:47:19.867760247 +0100 @@ -36,6 +36,7 @@ # include "FTGLBitmapFont.h" #endif +#include /** \class TGLFont \ingroup opengl @@ -419,7 +420,7 @@ ClassImp(TGLFontManager); TObjArray TGLFontManager::fgFontFileArray; -Int_t TGLFontManager::fgExtendedFontStart; +Int_t TGLFontManager::fgExtendedFontStart = 0; TGLFontManager::FontSizeVec_t TGLFontManager::fgFontSizeArray; Bool_t TGLFontManager::fgStaticInitDone = kFALSE; @@ -450,17 +451,175 @@ FontMap_i it = fFontMap.find(TGLFont(size, fileID, mode)); if (it == fFontMap.end()) { - TString ttpath, file; - ttpath = gEnv->GetValue("Root.TTGLFontPath", TROOT::GetTTFFontDir()); - { - //For extenede we have both ttf and otf. - char *fp = gSystem->Which(ttpath, fileID < fgExtendedFontStart ? - ((TObjString*)fgFontFileArray[fileID])->String() + ".ttf" : - ((TObjString*)fgFontFileArray[fileID])->String()); - file = fp; - delete [] fp; + char *file = NULL; + int ttindex = 0; + + FcPattern *pat, *match; + FcCharSet *set = NULL; + FcResult result; + + pat = FcPatternCreate (); + + switch (fileID) { + case 0: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 1: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 2: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 3: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 4: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 5: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 6: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 7: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 8: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 9: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 10: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 11: + case 14: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"symbol"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 12: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 13: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"dingbats"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 15: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 16: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 17: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 18: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixgeneral"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 19: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 20: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize1"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 21: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 22: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize2"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 23: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 24: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize3"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 25: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 26: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize4"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 27: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"stixsize5"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 28: + case 29: + case 30: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"droidsansfallback"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + set = FcCharSetCreate (); + FcCharSetAddChar (set, 0x0410); // Cyrillic + FcCharSetAddChar (set, 0x4e00); // CJK + FcPatternAddCharSet (pat, FC_CHARSET, set); } + FcConfigSubstitute (NULL, pat, FcMatchPattern); + FcDefaultSubstitute (pat); + match = FcFontMatch (NULL, pat, &result); + char *ttfnt; + FcPatternGetString (match, FC_FILE, 0, (FcChar8**)&ttfnt); + file = StrDup (ttfnt); + FcPatternGetInteger (match, FC_INDEX, 0, &ttindex); + FcPatternDestroy (match); + FcPatternDestroy (pat); + if (set) FcCharSetDestroy (set); + FTFont* ftfont = 0; switch (mode) { @@ -484,10 +643,14 @@ ftfont = new FTGLTextureFont(file); break; default: + delete [] file; Error("TGLFontManager::RegisterFont", "invalid FTGL type"); return; break; } + + delete [] file; + ftfont->FaceSize(size); const TGLFont &mf = fFontMap.insert(std::make_pair(TGLFont(size, fileID, mode, ftfont, 0), 1)).first->first; out.CopyAttributes(mf); @@ -570,8 +733,6 @@ { if (fgStaticInitDone == kFALSE) InitStatics(); - assert(fgExtendedFontStart > 0 && "GetExtendedFontStartIndex, invalid index"); - return fgExtendedFontStart; } @@ -641,28 +802,6 @@ fgFontFileArray.Add(new TObjString("wingding")); // 140 fgFontFileArray.Add(new TObjString("symbol")); // 150 - fgExtendedFontStart = fgFontFileArray.GetEntries(); - //"Extended" fonts for gl-pad. - //fgPadFontStart + ... - fgFontFileArray.Add(new TObjString("FreeSerifItalic.otf")); // 10 (160) - fgFontFileArray.Add(new TObjString("FreeSerifBold.otf")); // 20 (170) - fgFontFileArray.Add(new TObjString("FreeSerifBoldItalic.otf")); // 30 - - fgFontFileArray.Add(new TObjString("FreeSans.otf")); // 40 - fgFontFileArray.Add(new TObjString("FreeSansOblique.otf")); // 50 - fgFontFileArray.Add(new TObjString("FreeSansBold.otf")); // 60 - fgFontFileArray.Add(new TObjString("FreeSansBoldOblique.otf")); // 70 - - fgFontFileArray.Add(new TObjString("FreeMono.otf")); // 80 - fgFontFileArray.Add(new TObjString("FreeMonoOblique.otf")); // 90 - fgFontFileArray.Add(new TObjString("FreeMonoBold.otf")); // 100 - fgFontFileArray.Add(new TObjString("FreeMonoBoldOblique.otf")); // 110 - - fgFontFileArray.Add(new TObjString("symbol.ttf")); // 120 - fgFontFileArray.Add(new TObjString("FreeSerif.otf")); // 130 - fgFontFileArray.Add(new TObjString("wingding.ttf")); // 140 - fgFontFileArray.Add(new TObjString("symbol.ttf")); // 150 - fgFontFileArray.Add(new TObjString("STIXGeneral.otf")); // 200 fgFontFileArray.Add(new TObjString("STIXGeneralItalic.otf")); // 210 fgFontFileArray.Add(new TObjString("STIXGeneralBol.otf")); // 220 diff -ur root-6.28.00.orig/graf3d/gl/src/TGLText.cxx root-6.28.00/graf3d/gl/src/TGLText.cxx --- root-6.28.00.orig/graf3d/gl/src/TGLText.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/graf3d/gl/src/TGLText.cxx 2023-02-04 12:47:19.868760250 +0100 @@ -32,6 +32,8 @@ # include "FTGLBitmapFont.h" #endif +#include + #define FTGL_BITMAP 0 #define FTGL_PIXMAP 1 #define FTGL_OUTLINE 2 @@ -176,27 +178,92 @@ { int fontid = fontnumber / 10; - const char *fontname=0; - if (fontid == 0) fontname = "arialbd.ttf"; - if (fontid == 1) fontname = "timesi.ttf"; - if (fontid == 2) fontname = "timesbd.ttf"; - if (fontid == 3) fontname = "timesbi.ttf"; - if (fontid == 4) fontname = "arial.ttf"; - if (fontid == 5) fontname = "ariali.ttf"; - if (fontid == 6) fontname = "arialbd.ttf"; - if (fontid == 7) fontname = "arialbi.ttf"; - if (fontid == 8) fontname = "cour.ttf"; - if (fontid == 9) fontname = "couri.ttf"; - if (fontid == 10) fontname = "courbd.ttf"; - if (fontid == 11) fontname = "courbi.ttf"; - if (fontid == 12) fontname = "symbol.ttf"; - if (fontid == 13) fontname = "times.ttf"; - if (fontid == 14) fontname = "wingding.ttf"; - - // try to load font (font must be in Root.TTFontPath resource) - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *ttfont = gSystem->Which(ttpath, fontname, kReadPermission); + FcPattern *pat, *match; + FcResult result; + char *ttfont; + int ttindex; + + pat = FcPatternCreate (); + + switch (fontid) { + case 1: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 2: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 3: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 4: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 5: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 0: + case 6: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 7: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freesans"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 8: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 9: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 10: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 11: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freemono"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_BOLD); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ITALIC); + break; + case 12: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"symbol"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 13: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"freeserif"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + case 14: + FcPatternAddString (pat, FC_FAMILY, (const FcChar8*)"dingbats"); + FcPatternAddInteger (pat, FC_WEIGHT, FC_WEIGHT_REGULAR); + FcPatternAddInteger (pat, FC_SLANT, FC_SLANT_ROMAN); + break; + } + + FcConfigSubstitute (NULL, pat, FcMatchPattern); + FcDefaultSubstitute (pat); + match = FcFontMatch (NULL, pat, &result); + FcPatternGetString (match, FC_FILE, 0, (FcChar8**)&ttfont); + FcPatternGetInteger (match, FC_INDEX, 0, &ttindex); if (fGLTextFont) delete fGLTextFont; @@ -204,7 +271,9 @@ fGLTextFont = new FTGLPolygonFont(ttfont); + FcPatternDestroy (match); + FcPatternDestroy (pat); + if (!fGLTextFont->FaceSize(1)) Error("SetGLTextFont","Cannot set FTGL::FaceSize"); - delete [] ttfont; } diff -ur root-6.28.00.orig/gui/gui/src/TGApplication.cxx root-6.28.00/gui/gui/src/TGApplication.cxx --- root-6.28.00.orig/gui/gui/src/TGApplication.cxx 2023-02-03 15:34:27.000000000 +0100 +++ root-6.28.00/gui/gui/src/TGApplication.cxx 2023-02-04 12:47:19.868760250 +0100 @@ -81,20 +81,12 @@ gROOT->SetBatch(kFALSE); if (strcmp(appClassName, "proofserv")) { - const char *ttpath = gEnv->GetValue("Root.TTFontPath", - TROOT::GetTTFFontDir()); - char *ttfont = gSystem->Which(ttpath, "arialbd.ttf", kReadPermission); - // Added by cholm for use of DFSG - fonts - based on fix by Kevin - if (!ttfont) - ttfont = gSystem->Which(ttpath, "FreeSansBold.ttf", kReadPermission); - if (ttfont && gEnv->GetValue("Root.UseTTFonts", 1)) { + if (gEnv->GetValue("Root.UseTTFonts", 1)) { TPluginHandler *h; if ((h = gROOT->GetPluginManager()->FindHandler("TVirtualX", "x11ttf"))) if (h->LoadPlugin() == -1) Info("TGApplication", "no TTF support"); } - - delete [] ttfont; } // Create the canvas colors early so they are allocated before