summaryrefslogtreecommitdiffstats
path: root/src/libnrtype
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-09-09 21:15:05 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-09-09 21:15:05 +0000
commitbff5da8f40ab650dafa8f8a2b24a0a8d386df98c (patch)
tree99f3aa3d60390f09148e33d3a235e51b37291b5a /src/libnrtype
parentUpdate .po files (diff)
downloadinkscape-bff5da8f40ab650dafa8f8a2b24a0a8d386df98c.tar.gz
inkscape-bff5da8f40ab650dafa8f8a2b24a0a8d386df98c.zip
Load GPOS table only when selecting font features tab to speedup font usage
Diffstat (limited to 'src/libnrtype')
-rw-r--r--src/libnrtype/FontInstance.cpp17
-rw-r--r--src/libnrtype/font-instance.h7
2 files changed, 16 insertions, 8 deletions
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp
index 2253b49c8..5a3d5aa9f 100644
--- a/src/libnrtype/FontInstance.cpp
+++ b/src/libnrtype/FontInstance.cpp
@@ -113,7 +113,8 @@ font_instance::font_instance() :
maxGlyph(0),
glyphs(nullptr),
theFace(nullptr),
- fontHasSVG(false)
+ fontHasSVG(false),
+ fulloaded(false)
{
//printf("font instance born\n");
_ascent = _ascent_max = 0.8;
@@ -186,10 +187,12 @@ void font_instance::Unref()
}
}
-void font_instance::InitTheFace()
+void font_instance::InitTheFace(bool loadgsub)
{
- if (theFace == nullptr && pFont != nullptr) {
-
+ if (pFont != nullptr && (theFace == nullptr || (loadgsub && !fulloaded))) {
+ if (theFace) {
+ theFace = nullptr;
+ }
#ifdef USE_PANGO_WIN32
LOGFONT *lf=pango_win32_font_logfont(pFont);
@@ -213,8 +216,10 @@ void font_instance::InitTheFace()
#endif
#ifndef USE_PANGO_WIN32
-
- readOpenTypeGsubTable( theFace, openTypeTables );
+ if (loadgsub) {
+ readOpenTypeGsubTable( theFace, openTypeTables );
+ fulloaded = true;
+ }
readOpenTypeFvarAxes( theFace, openTypeVarAxes );
readOpenTypeSVGTable( theFace, openTypeSVGGlyphs );
diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h
index 0dc9c40d0..b30652bdd 100644
--- a/src/libnrtype/font-instance.h
+++ b/src/libnrtype/font-instance.h
@@ -47,8 +47,12 @@ public:
// common glyph definitions for all the rasterfonts
std::map<int, int> id_to_no;
int nbGlyph, maxGlyph;
+
font_glyph* glyphs;
+ // font is loaded with GSUB in 2 pass
+ bool fulloaded;
+
// Map of OpenType tables found in font.
std::map<Glib::ustring, OTSubstitution> openTypeTables;
@@ -71,7 +75,7 @@ public:
void InstallFace(PangoFont* iFace); // utility; should reset the pFont field if loading failed
// in case the PangoFont is a bitmap font, for example. that way, the calling function
// will be able to check the validity of the font before installing it in loadedFaces
- void InitTheFace();
+ void InitTheFace(bool loadgsub = false);
int MapUnicodeChar(gunichar c); // calls the relevant unicode->glyph index function
void LoadGlyph(int glyph_id); // the main backend-dependent function
@@ -124,7 +128,6 @@ public:
#endif
private:
-
// Font metrics in em-box units
double _ascent; // Typographic ascent.
double _descent; // Typographic descent.