diff --git a/3rdparty/fontconfig/functions.d b/3rdparty/fontconfig/functions.d new file mode 100644 index 00000000..86fae8ec --- /dev/null +++ b/3rdparty/fontconfig/functions.d @@ -0,0 +1,73 @@ +module fontconfig.functions; + +public import fontconfig.types; + + +extern( C ) @nogc nothrow { + + alias da_FC_FcObjectSetBuild = FcObjectSet * function(const char *first, ...); + + alias da_FC_FcPatternCreate = FcPattern * function(); + + alias da_FC_FcPatternAddBool = FcBool function(FcPattern *p, const char *object, FcBool b); + + alias da_FC_FcFontList = FcFontSet * function(FcConfig *config, FcPattern *p, FcObjectSet *os); + + alias da_FC_FcPatternDestroy = void function(FcPattern *p); + + alias da_FC_FcObjectSetDestroy = void function(FcObjectSet *os); + + alias da_FC_FcPatternGetString = FcResult function(const FcPattern *p, const char *object, int n, FcChar8 ** s); + + alias da_FC_FcPatternGetInteger = FcResult function(const FcPattern *p, const char *object, int n, int *i); + + alias da_FC_FcPatternGetBool = FcResult function(const FcPattern *p, const char *object, int n, FcBool *b); + + alias da_FC_FcFontSetDestroy = void function(FcFontSet *s); +} + +__gshared { + + da_FC_FcObjectSetBuild FcObjectSetBuild; + + da_FC_FcPatternCreate FcPatternCreate; + + da_FC_FcPatternAddBool FcPatternAddBool; + + da_FC_FcFontList FcFontList; + + da_FC_FcPatternDestroy FcPatternDestroy; + + da_FC_FcObjectSetDestroy FcObjectSetDestroy; + + da_FC_FcPatternGetString FcPatternGetString; + + da_FC_FcPatternGetInteger FcPatternGetInteger; + + da_FC_FcPatternGetBool FcPatternGetBool; + + da_FC_FcFontSetDestroy FcFontSetDestroy; +} + +/+ +extern(C) FcObjectSet * FcObjectSetBuild(const char *first, ...); + +extern(C) FcPattern * FcPatternCreate(); + +extern(C) FcBool FcPatternAddBool(FcPattern *p, const char *object, FcBool b); + +extern(C) FcFontSet * FcFontList(FcConfig *config, FcPattern *p, FcObjectSet *os); + +extern(C) void FcPatternDestroy(FcPattern *p); + +extern(C) void FcObjectSetDestroy(FcObjectSet *os); + +extern(C) FcResult FcPatternGetString(const FcPattern *p, const char *object, int n, FcChar8 ** s); + +extern(C) FcResult FcPatternGetInteger(const FcPattern *p, const char *object, int n, int *i); + +extern(C) FcResult FcPatternGetBool (const FcPattern *p, const char *object, int n, FcBool *b); + +extern(C) void FcFontSetDestroy (FcFontSet *s); + ++/ \ No newline at end of file diff --git a/3rdparty/fontconfig/package.d b/3rdparty/fontconfig/package.d new file mode 100644 index 00000000..d2860086 --- /dev/null +++ b/3rdparty/fontconfig/package.d @@ -0,0 +1,44 @@ +module fontconfig; + +public import fontconfig.types; +public import fontconfig.functions; + +private { + import derelict.util.loader; + import derelict.util.system; + + static if( Derelict_OS_Windows ) + enum libNames = "libfontconfig-1.dll"; + else static if( Derelict_OS_Mac ) + enum libNames = "/usr/local/lib/libfontconfig.dylib"; + else static if( Derelict_OS_Posix ) + enum libNames = "libfontconfig.so.1, libfontconfig.so"; + else + static assert( 0, "Need to implement FontConfig libNames for this operating system." ); +} + + +class DerelictFCLoader : SharedLibLoader { + public this() { + super( libNames ); + } + + protected override void loadSymbols() { + bindFunc( cast( void** )&FcObjectSetBuild, "FcObjectSetBuild" ); + bindFunc( cast( void** )&FcPatternCreate, "FcPatternCreate" ); + bindFunc( cast( void** )&FcPatternAddBool, "FcPatternAddBool" ); + bindFunc( cast( void** )&FcFontList, "FcFontList" ); + bindFunc( cast( void** )&FcPatternDestroy, "FcPatternDestroy" ); + bindFunc( cast( void** )&FcObjectSetDestroy, "FcObjectSetDestroy" ); + bindFunc( cast( void** )&FcPatternGetString, "FcPatternGetString" ); + bindFunc( cast( void** )&FcPatternGetInteger, "FcPatternGetInteger" ); + bindFunc( cast( void** )&FcPatternGetBool, "FcPatternGetBool" ); + bindFunc( cast( void** )&FcFontSetDestroy, "FcFontSetDestroy" ); + } +} + +__gshared DerelictFCLoader DerelictFC; + +shared static this() { + DerelictFC = new DerelictFCLoader(); +} diff --git a/3rdparty/fontconfig/types.d b/3rdparty/fontconfig/types.d new file mode 100644 index 00000000..50f28b55 --- /dev/null +++ b/3rdparty/fontconfig/types.d @@ -0,0 +1,200 @@ +module fontconfig.types; + +import std.string : toStringz, fromStringz, toLower; +import std.algorithm : endsWith; + +alias FcChar8 = char; +alias FcChar16 = wchar; +alias FcChar32 = dchar; +alias FcBool = int; + +enum : int { + FcFalse = 0, + FcTrue = 1 +} + +struct FcMatrix { + double xx, xy, yx, yy; +} + +struct FcCharSet {} + +struct FcLangSet {} + +struct FcConfig {} + +enum : int { + FcTypeUnknown = -1, + FcTypeVoid, + FcTypeInteger, + FcTypeDouble, + FcTypeString, + FcTypeBool, + FcTypeMatrix, + FcTypeCharSet, + FcTypeFTFace, + FcTypeLangSet, + FcTypeRange +} + +alias FcType = int; + +enum : int { + FcResultMatch, + FcResultNoMatch, + FcResultTypeMismatch, + FcResultNoId, + FcResultOutOfMemory +} + +alias FcResult = int; + +struct FcValue { + FcType type; + union { + const FcChar8 *s; + int i; + FcBool b; + double d; + const FcMatrix *m; + const FcCharSet *c; + void *f; + const FcLangSet *l; + const FcRange *r; + } +} + +enum FcMatchKind { + FcMatchPattern, + FcMatchFont, + FcMatchScan +} + +enum FcLangResult { + FcLangEqual = 0, + FcLangDifferentCountry = 1, + FcLangDifferentTerritory = 1, + FcLangDifferentLang = 2 +} + +enum FcSetName { + FcSetSystem = 0, + FcSetApplication = 1 +} + +enum FcEndian { + FcEndianBig, + FcEndianLittle +} + +struct FcFontSet { + int nfont; + int sfont; + FcPattern **fonts; +} + +struct FcObjectSet { + int nobject; + int sobject; + const char **objects; +} + +struct FcPattern {} + +struct FcRange {} + +enum { + FC_WEIGHT_THIN = 0, + FC_WEIGHT_EXTRALIGHT = 40, + FC_WEIGHT_ULTRALIGHT = FC_WEIGHT_EXTRALIGHT, + FC_WEIGHT_LIGHT = 50, + FC_WEIGHT_DEMILIGHT = 55, + FC_WEIGHT_SEMILIGHT = FC_WEIGHT_DEMILIGHT, + FC_WEIGHT_BOOK = 75, + FC_WEIGHT_REGULAR = 80, + FC_WEIGHT_NORMAL = FC_WEIGHT_REGULAR, + FC_WEIGHT_MEDIUM = 100, + FC_WEIGHT_DEMIBOLD = 180, + FC_WEIGHT_SEMIBOLD = FC_WEIGHT_DEMIBOLD, + FC_WEIGHT_BOLD = 200, + FC_WEIGHT_EXTRABOLD = 205, + FC_WEIGHT_ULTRABOLD = FC_WEIGHT_EXTRABOLD, + FC_WEIGHT_BLACK = 210, + FC_WEIGHT_HEAVY = FC_WEIGHT_BLACK, + FC_WEIGHT_EXTRABLACK = 215, + FC_WEIGHT_ULTRABLACK = FC_WEIGHT_EXTRABLACK +} + +enum { + FC_SLANT_ROMAN =0, + FC_SLANT_ITALIC =100, + FC_SLANT_OBLIQUE =110 +} + +enum { + FC_WIDTH_ULTRACONDENSED =50, + FC_WIDTH_EXTRACONDENSED =63, + FC_WIDTH_CONDENSED =75, + FC_WIDTH_SEMICONDENSED =87, + FC_WIDTH_NORMAL =100, + FC_WIDTH_SEMIEXPANDED =113, + FC_WIDTH_EXPANDED =125, + FC_WIDTH_EXTRAEXPANDED =150, + FC_WIDTH_ULTRAEXPANDED =200 +} + +enum { + FC_PROPORTIONAL =0, + FC_DUAL =90, + FC_MONO =100, + FC_CHARCELL =110 +} + +const FC_FAMILY = "family"; /* String */ +const FC_STYLE = "style"; /* String */ +const FC_SLANT = "slant"; /* Int */ +const FC_WEIGHT = "weight"; /* Int */ +const FC_SIZE = "size"; /* Range (double) */ +const FC_ASPECT = "aspect"; /* Double */ +const FC_PIXEL_SIZE = "pixelsize"; /* Double */ +const FC_SPACING = "spacing"; /* Int */ +const FC_FOUNDRY = "foundry"; /* String */ +const FC_ANTIALIAS = "antialias"; /* Bool (depends) */ +const FC_HINTING = "hinting"; /* Bool (true) */ +const FC_HINT_STYLE = "hintstyle"; /* Int */ +const FC_VERTICAL_LAYOUT = "verticallayout"; /* Bool (false) */ +const FC_AUTOHINT = "autohint"; /* Bool (false) */ +const FC_GLOBAL_ADVANCE = "globaladvance"; /* Bool (true) */ +const FC_WIDTH = "width"; /* Int */ +const FC_FILE = "file"; /* String */ +const FC_INDEX = "index"; /* Int */ +const FC_FT_FACE = "ftface"; /* FT_Face */ +const FC_RASTERIZER = "rasterizer"; /* String (deprecated) */ +const FC_OUTLINE = "outline"; /* Bool */ +const FC_SCALABLE = "scalable"; /* Bool */ +const FC_COLOR = "color"; /* Bool */ +const FC_SCALE = "scale"; /* double */ +const FC_DPI = "dpi"; /* double */ +const FC_RGBA = "rgba"; /* Int */ +const FC_MINSPACE = "minspace"; /* Bool use minimum line spacing */ +const FC_SOURCE = "source"; /* String (deprecated) */ +const FC_CHARSET = "charset"; /* CharSet */ +const FC_LANG = "lang"; /* String RFC 3066 langs */ +const FC_FONTVERSION = "fontversion"; /* Int from 'head' table */ +const FC_FULLNAME = "fullname"; /* String */ +const FC_FAMILYLANG = "familylang"; /* String RFC 3066 langs */ +const FC_STYLELANG = "stylelang"; /* String RFC 3066 langs */ +const FC_FULLNAMELANG = "fullnamelang"; /* String RFC 3066 langs */ +const FC_CAPABILITY = "capability"; /* String */ +const FC_FONTFORMAT = "fontformat"; /* String */ +const FC_EMBOLDEN = "embolden"; /* Bool - true if emboldening needed*/ +const FC_EMBEDDED_BITMAP = "embeddedbitmap"; /* Bool - true to enable embedded bitmaps */ +const FC_DECORATIVE = "decorative"; /* Bool - true if style is a decorative variant */ +const FC_LCD_FILTER = "lcdfilter"; /* Int */ +const FC_FONT_FEATURES = "fontfeatures"; /* String */ +const FC_NAMELANG = "namelang"; /* String RFC 3866 langs */ +const FC_PRGNAME = "prgname"; /* String */ +const FC_HASH = "hash"; /* String (deprecated) */ +const FC_POSTSCRIPT_NAME = "postscriptname"; /* String */ + + diff --git a/dlanguilib.visualdproj b/dlanguilib.visualdproj index fed3d09a..792abe73 100644 --- a/dlanguilib.visualdproj +++ b/dlanguilib.visualdproj @@ -298,6 +298,11 @@ + + + + + diff --git a/src/dlangui/graphics/ftfonts.d b/src/dlangui/graphics/ftfonts.d index 1051c1d8..b78e1bd9 100644 --- a/src/dlangui/graphics/ftfonts.d +++ b/src/dlangui/graphics/ftfonts.d @@ -615,3 +615,223 @@ class FreeTypeFontManager : FontManager { } private int myabs(int n) { return n >= 0 ? n : -n; } + + + +bool registerFontConfigFonts(FreeTypeFontManager fontMan) { + import fontconfig; + + try { + DerelictFC.load(); + } catch (Exception e) { + Log.w("Cannot load FontConfig shared library"); + return false; + } + + FcFontSet *fontset; + + FcObjectSet *os = FcObjectSetBuild(FC_FILE.toStringz, FC_WEIGHT.toStringz, FC_FAMILY.toStringz, + FC_SLANT.toStringz, FC_SPACING.toStringz, FC_INDEX.toStringz, + FC_STYLE.toStringz, null); + FcPattern *pat = FcPatternCreate(); + //FcBool b = 1; + FcPatternAddBool(pat, FC_SCALABLE.toStringz, 1); + + fontset = FcFontList(null, pat, os); + + FcPatternDestroy(pat); + FcObjectSetDestroy(os); + + int facesFound = 0; + + // load fonts from file + //CRLog::debug("FONTCONFIG: %d font files found", fontset->nfont); + for(int i = 0; i < fontset.nfont; i++) { + const (FcChar8) *s = "".toStringz; + const (FcChar8) *family = "".toStringz; + const (FcChar8) *style = "".toStringz; + //FcBool b; + FcResult res; + //FC_SCALABLE + //res = FcPatternGetBool( fontset->fonts[i], FC_OUTLINE, 0, (FcBool*)&b); + //if(res != FcResultMatch) + // continue; + //if ( !b ) + // continue; // skip non-scalable fonts + res = FcPatternGetString(fontset.fonts[i], FC_FILE.toStringz, 0, cast(FcChar8 **)&s); + if (res != FcResultMatch) { + continue; + } + string fn = fromStringz(s).dup; + string fn16 = toLower(fn); + if (!fn16.endsWith(".ttf") && !fn16.endsWith(".odf") && !fn16.endsWith(".otf") && !fn16.endsWith(".pfb") && !fn16.endsWith(".pfa") ) { + continue; + } + int weight = FC_WEIGHT_MEDIUM; + res = FcPatternGetInteger(fontset.fonts[i], FC_WEIGHT.toStringz, 0, &weight); + if(res != FcResultMatch) { + //CRLog::debug("no FC_WEIGHT for %s", s); + //continue; + } + switch ( weight ) { + case FC_WEIGHT_THIN: // 0 + weight = 100; + break; + case FC_WEIGHT_EXTRALIGHT: // 40 + //case FC_WEIGHT_ULTRALIGHT FC_WEIGHT_EXTRALIGHT + weight = 200; + break; + case FC_WEIGHT_LIGHT: // 50 + case FC_WEIGHT_BOOK: // 75 + case FC_WEIGHT_REGULAR: // 80 + //case FC_WEIGHT_NORMAL: FC_WEIGHT_REGULAR + weight = 400; + break; + case FC_WEIGHT_MEDIUM: // 100 + weight = 500; + break; + case FC_WEIGHT_DEMIBOLD: // 180 + //case FC_WEIGHT_SEMIBOLD: FC_WEIGHT_DEMIBOLD + weight = 600; + break; + case FC_WEIGHT_BOLD: // 200 + weight = 700; + break; + case FC_WEIGHT_EXTRABOLD: // 205 + //case FC_WEIGHT_ULTRABOLD: FC_WEIGHT_EXTRABOLD + weight = 800; + break; + case FC_WEIGHT_BLACK: // 210 + //case FC_WEIGHT_HEAVY: FC_WEIGHT_BLACK + weight = 900; + break; + case FC_WEIGHT_EXTRABLACK: // 215 + //case FC_WEIGHT_ULTRABLACK: FC_WEIGHT_EXTRABLACK + weight = 900; + break; + default: + weight = 400; + break; + } + FcBool scalable = 0; + res = FcPatternGetBool(fontset.fonts[i], FC_SCALABLE.toStringz, 0, &scalable); + int index = 0; + res = FcPatternGetInteger(fontset.fonts[i], FC_INDEX.toStringz, 0, &index); + if(res != FcResultMatch) { + //CRLog::debug("no FC_INDEX for %s", s); + //continue; + } + res = FcPatternGetString(fontset.fonts[i], FC_FAMILY.toStringz, 0, cast(FcChar8 **)&family); + if(res != FcResultMatch) { + //CRLog::debug("no FC_FAMILY for %s", s); + continue; + } + res = FcPatternGetString(fontset.fonts[i], FC_STYLE.toStringz, 0, cast(FcChar8 **)&style); + if(res != FcResultMatch) { + //CRLog::debug("no FC_STYLE for %s", s); + style = "".toStringz; + //continue; + } + int slant = FC_SLANT_ROMAN; + res = FcPatternGetInteger(fontset.fonts[i], FC_SLANT.toStringz, 0, &slant); + if(res != FcResultMatch) { + //CRLog::debug("no FC_SLANT for %s", s); + //continue; + } + int spacing = 0; + res = FcPatternGetInteger(fontset.fonts[i], FC_SPACING.toStringz, 0, &spacing); + if(res != FcResultMatch) { + //CRLog::debug("no FC_SPACING for %s", s); + //continue; + } +// int cr_weight; +// switch(weight) { +// case FC_WEIGHT_LIGHT: cr_weight = 200; break; +// case FC_WEIGHT_MEDIUM: cr_weight = 300; break; +// case FC_WEIGHT_DEMIBOLD: cr_weight = 500; break; +// case FC_WEIGHT_BOLD: cr_weight = 700; break; +// case FC_WEIGHT_BLACK: cr_weight = 800; break; +// default: cr_weight=300; break; +// } + FontFamily fontFamily = FontFamily.SansSerif; + string face16 = family.fromStringz.toLower.dup; + if (spacing == FC_MONO) + fontFamily = FontFamily.MonoSpace; + else if (face16.indexOf("sans") >= 0) + fontFamily = FontFamily.SansSerif; + else if (face16.indexOf("serif") >= 0) + fontFamily = FontFamily.Serif; + + //css_ff_inherit, + //css_ff_serif, + //css_ff_sans_serif, + //css_ff_cursive, + //css_ff_fantasy, + //css_ff_monospace, + bool italic = (slant!=FC_SLANT_ROMAN); + + string face = family.fromStringz.dup; + string style16 = style.fromStringz.toLower.dup; + if (style16.indexOf("condensed") >= 0) + face ~= " Condensed"; + else if (style16.indexOf("extralight") >= 0) + face ~= " Extra Light"; + + if (fontMan.registerFont(fn, fontFamily, face, italic, weight)) + facesFound++; +/* + LVFontDef def( + lString8((const char*)s), + -1, // height==-1 for scalable fonts + weight, + italic, + fontFamily, + face, + index + ); + + CRLog::debug("FONTCONFIG: Font family:%s style:%s weight:%d slant:%d spacing:%d file:%s", family, style, weight, slant, spacing, s); + if ( _cache.findDuplicate( &def ) ) { + CRLog::debug("is duplicate, skipping"); + continue; + } + _cache.update( &def, LVFontRef(NULL) ); + + if ( scalable && !def.getItalic() ) { + LVFontDef newDef( def ); + newDef.setItalic(2); // can italicize + if ( !_cache.findDuplicate( &newDef ) ) + _cache.update( &newDef, LVFontRef(NULL) ); + } + + */ + facesFound++; + + + } + + FcFontSetDestroy(fontset); + + + Log.i("FontConfig: ", facesFound, " font files registered"); + //CRLog::info("FONTCONFIG: %d fonts registered", facesFound); + + /+ + string[] fallback_faces = [ + "Arial Unicode MS", + "AR PL ShanHeiSun Uni", + "Liberation Sans" + // TODO: more faces + ]; + + for ( int i=0; fallback_faces[i]; i++ ) + if ( SetFallbackFontFace(lString8(fallback_faces[i])) ) { + //CRLog::info("Fallback font %s is found", fallback_faces[i]); + break; + } else { + //CRLog::trace("Fallback font %s is not found", fallback_faces[i]); + } + +/ + + return facesFound > 0; +} diff --git a/src/dlangui/platforms/common/platform.d b/src/dlangui/platforms/common/platform.d index ea0caaf1..a47bac94 100644 --- a/src/dlangui/platforms/common/platform.d +++ b/src/dlangui/platforms/common/platform.d @@ -1504,33 +1504,36 @@ version (Windows) { /// On linux/mac - tries to init freetype with some hardcoded font paths bool initFontManager() { FreeTypeFontManager ft = new FreeTypeFontManager(); - // TODO: use FontConfig - Log.w("Only hardcoded paths to TTF fonts are supported under linux so far. TODO: implement fontconfig support."); - ft.registerFonts("/usr/share/fonts/truetype/dejavu/"); - ft.registerFonts("/usr/share/fonts/TTF/"); - ft.registerFonts("/usr/share/fonts/dejavu/"); - ft.registerFonts("/usr/share/fonts/truetype/ttf-dejavu/"); // let it compile on Debian Wheezy - version(OSX) { - ft.registerFont("/Library/Fonts/Arial.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Arial Bold.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Arial Italic.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Arial Bold Italic.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Arial Narrow.ttf", FontFamily.SansSerif, "Arial Narrow", false, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Arial Narrow Bold.ttf", FontFamily.SansSerif, "Arial Narrow", false, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Arial Narrow Italic.ttf", FontFamily.SansSerif, "Arial Narrow", true, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Arial Narrow Bold Italic.ttf", FontFamily.SansSerif, "Arial Narrow", true, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Courier New.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Courier New Bold.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Courier New Italic.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Courier New Bold Italic.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Georgia.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Georgia Bold.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Georgia.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Georgia Bold.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Bold); - ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal); - ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold); + + if (!registerFontConfigFonts(ft)) { + // TODO: use FontConfig + Log.w("No fonts found using FontConfig. Trying hardcoded paths."); + ft.registerFonts("/usr/share/fonts/truetype/dejavu/"); + ft.registerFonts("/usr/share/fonts/TTF/"); + ft.registerFonts("/usr/share/fonts/dejavu/"); + ft.registerFonts("/usr/share/fonts/truetype/ttf-dejavu/"); // let it compile on Debian Wheezy + version(OSX) { + ft.registerFont("/Library/Fonts/Arial.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Arial Bold.ttf", FontFamily.SansSerif, "Arial", false, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Arial Italic.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Arial Bold Italic.ttf", FontFamily.SansSerif, "Arial", true, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Arial Narrow.ttf", FontFamily.SansSerif, "Arial Narrow", false, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Arial Narrow Bold.ttf", FontFamily.SansSerif, "Arial Narrow", false, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Arial Narrow Italic.ttf", FontFamily.SansSerif, "Arial Narrow", true, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Arial Narrow Bold Italic.ttf", FontFamily.SansSerif, "Arial Narrow", true, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Courier New.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Courier New Bold.ttf", FontFamily.MonoSpace, "Courier New", false, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Courier New Italic.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Courier New Bold Italic.ttf", FontFamily.MonoSpace, "Courier New", true, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Georgia.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Georgia Bold.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Georgia.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Georgia Bold.ttf", FontFamily.SansSerif, "Georgia", false, FontWeight.Bold); + ft.registerFont("/Library/Fonts/Georgia Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Normal); + ft.registerFont("/Library/Fonts/Georgia Bold Italic.ttf", FontFamily.SansSerif, "Georgia", true, FontWeight.Bold); + } } if (!ft.registeredFontCount)