root/root-fontconfig.patch
Mattias Ellert aff214ede0 Update to 6.18.00
Drop patches accepted upstream:
  root-avoid-gui-crash.patch
  root-doxygen-generation-with-python-3.patch
Drop patches with alternative fix implemented upstream:
  root-dont-install-eve7-files.patch
  root-ix32-geom-opt.patch
Drop ppc64 specific workaround (ppc64 no longer built in Fedora or EPEL):
  root-ppc64-doc.patch
Dropped subpackages:
  root-geocad
  root-graf-qt
  root-gui-qt
  root-gui-qtgsi
  root-io-hdfs
  root-io-rfio
  root-net-bonjour
  root-net-globus
  root-net-ldap
  root-net-krb5
  root-table
Drop BuildRequires needed by the dropped subpackages
New subpackages:
  root-graf3d-csg (split off from root-graf3d-gl)
  root-gui-browserv7
  root-tree-ntuple
Don't build python2-root for Fedora >= 31
Include desktop and MIME type files in source RPM (removed from source)
Install man pages in correct directory
Use correct library names in plugin definitions
Don't download test input file if it already exists
Python 3 fixes
Increase test tolerance (aarch64 and ppc64le)
Fix GDB pretty printers install name and location
2019-07-03 14:52:40 +02:00

1493 lines
61 KiB
Diff

diff -ur root-6.18.00.orig/core/base/src/TApplication.cxx root-6.18.00/core/base/src/TApplication.cxx
--- root-6.18.00.orig/core/base/src/TApplication.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/core/base/src/TApplication.cxx 2019-06-26 15:00:32.048047903 +0200
@@ -267,18 +267,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
@@ -292,7 +285,6 @@
}
}
#endif
- delete [] ttfont;
// Create WM dependent application environment
if (fAppImp)
diff -ur root-6.18.00.orig/graf2d/asimage/CMakeLists.txt root-6.18.00/graf2d/asimage/CMakeLists.txt
--- root-6.18.00.orig/graf2d/asimage/CMakeLists.txt 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/asimage/CMakeLists.txt 2019-06-26 15:05:32.584912789 +0200
@@ -26,6 +26,7 @@
${FREETYPE_LIBRARIES}
${X11_LIBRARIES}
ZLIB::ZLIB
+ fontconfig
DEPENDENCIES
Core
Graf
diff -ur root-6.18.00.orig/graf2d/asimage/src/TASImage.cxx root-6.18.00/graf2d/asimage/src/TASImage.cxx
--- root-6.18.00.orig/graf2d/asimage/src/TASImage.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/asimage/src/TASImage.cxx 2019-06-26 15:00:32.062047757 +0200
@@ -110,6 +110,8 @@
# include <draw.h>
}
+#include <fontconfig/fontconfig.h>
+
// auxiliary functions for general polygon filling
#include "TASPolyUtils.c"
@@ -2593,14 +2595,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;
@@ -2624,14 +2732,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.18.00.orig/graf2d/graf/CMakeLists.txt root-6.18.00/graf2d/graf/CMakeLists.txt
--- root-6.18.00.orig/graf2d/graf/CMakeLists.txt 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/graf/CMakeLists.txt 2019-06-26 15:03:42.153064782 +0200
@@ -87,6 +87,7 @@
${FREETYPE_LIBRARIES}
ZLIB::ZLIB
mathtext
+ fontconfig
DEPENDENCIES
Hist
Matrix
diff -ur root-6.18.00.orig/graf2d/graf/inc/TTF.h root-6.18.00/graf2d/graf/inc/TTF.h
--- root-6.18.00.orig/graf2d/graf/inc/TTF.h 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/graf/inc/TTF.h 2019-06-26 15:00:32.063047746 +0200
@@ -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.18.00.orig/graf2d/graf/src/TTF.cxx root-6.18.00/graf2d/graf/src/TTF.cxx
--- root-6.18.00.orig/graf2d/graf/src/TTF.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/graf/src/TTF.cxx 2019-06-26 15:00:32.064047736 +0200
@@ -25,6 +25,8 @@
#include "TMath.h"
#include "TError.h"
+#include <fontconfig/fontconfig.h>
+
// 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;
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]))
@@ -378,27 +390,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;
}
}
@@ -406,151 +538,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 = 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] = 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.18.00.orig/graf2d/postscript/CMakeLists.txt root-6.18.00/graf2d/postscript/CMakeLists.txt
--- root-6.18.00.orig/graf2d/postscript/CMakeLists.txt 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/postscript/CMakeLists.txt 2019-06-26 15:06:11.017511871 +0200
@@ -21,6 +21,7 @@
LIBRARIES
ZLIB::ZLIB
mathtext
+ fontconfig
DEPENDENCIES
Graf
)
diff -ur root-6.18.00.orig/graf2d/postscript/src/TPostScript.cxx root-6.18.00/graf2d/postscript/src/TPostScript.cxx
--- root-6.18.00.orig/graf2d/postscript/src/TPostScript.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf2d/postscript/src/TPostScript.cxx 2019-06-26 15:00:32.065047726 +0200
@@ -229,6 +229,7 @@
#include <string.h>
#include <ctype.h>
#include <wchar.h>
+#include <fontconfig/fontconfig.h>
#include "Riostream.h"
#include "Byteswap.h"
@@ -1575,56 +1576,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
@@ -1633,9 +1757,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;
}
@@ -2803,10 +2926,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.18.00.orig/graf3d/gl/CMakeLists.txt root-6.18.00/graf3d/gl/CMakeLists.txt
--- root-6.18.00.orig/graf3d/gl/CMakeLists.txt 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf3d/gl/CMakeLists.txt 2019-06-26 15:02:38.318730684 +0200
@@ -206,6 +206,7 @@
${FTGL_LIBRARIES}
${GL2PS_LIBRARIES}
${X11_LIBRARIES}
+ fontconfig
DEPENDENCIES
Hist
Gui
diff -ur root-6.18.00.orig/graf3d/gl/src/TGLFontManager.cxx root-6.18.00/graf3d/gl/src/TGLFontManager.cxx
--- root-6.18.00.orig/graf3d/gl/src/TGLFontManager.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf3d/gl/src/TGLFontManager.cxx 2019-06-26 15:00:32.066047715 +0200
@@ -37,6 +37,7 @@
# include "FTGLBitmapFont.h"
#endif
+#include <fontconfig/fontconfig.h>
/** \class TGLFont
\ingroup opengl
@@ -420,7 +421,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;
@@ -451,17 +452,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)
{
@@ -485,10 +644,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);
@@ -571,8 +734,6 @@
{
if (fgStaticInitDone == kFALSE) InitStatics();
- assert(fgExtendedFontStart > 0 && "GetExtendedFontStartIndex, invalid index");
-
return fgExtendedFontStart;
}
@@ -642,28 +803,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.18.00.orig/graf3d/gl/src/TGLText.cxx root-6.18.00/graf3d/gl/src/TGLText.cxx
--- root-6.18.00.orig/graf3d/gl/src/TGLText.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/graf3d/gl/src/TGLText.cxx 2019-06-26 15:00:32.066047715 +0200
@@ -34,6 +34,8 @@
# include "FTGLBitmapFont.h"
#endif
+#include <fontconfig/fontconfig.h>
+
#define FTGL_BITMAP 0
#define FTGL_PIXMAP 1
#define FTGL_OUTLINE 2
@@ -178,27 +180,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;
@@ -206,7 +273,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.18.00.orig/gui/gui/src/TGApplication.cxx root-6.18.00/gui/gui/src/TGApplication.cxx
--- root-6.18.00.orig/gui/gui/src/TGApplication.cxx 2019-06-25 10:52:11.000000000 +0200
+++ root-6.18.00/gui/gui/src/TGApplication.cxx 2019-06-26 15:00:32.066047715 +0200
@@ -83,20 +83,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