summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Hosken <martin_hosken@sil.org>2015-02-09 16:49:12 +0700
committerAndras Timar <andras.timar@collabora.com>2015-02-23 10:33:57 +0100
commit6687c994b5d5b70f500712bf7df1dc7e41e14876 (patch)
tree50695c5afd5ace0d75c93fa1184211f7b3d2d1a1
parent4c4ef415e2087084f474c02c104d08fff37e0268 (diff)
Resolves: tdf#89252 Fix bold, regular font spacing bug for Graphite fonts
Change-Id: I31a09fa753ed15e302e5407ce8a0c46f3b13e099 Reviewed-on: https://gerrit.libreoffice.org/14380 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 0ed14401925d16932ed98bc418d395adac047b39) Reviewed-on: https://gerrit.libreoffice.org/14439 (cherry picked from commit 0c2447648961bc8fa4776f996604fead893e3be4)
-rw-r--r--vcl/generic/glyphs/graphite_serverfont.cxx4
-rw-r--r--vcl/inc/graphite_layout.hxx18
2 files changed, 13 insertions, 9 deletions
diff --git a/vcl/generic/glyphs/graphite_serverfont.cxx b/vcl/generic/glyphs/graphite_serverfont.cxx
index 09159e4d985b..3549c01c8bab 100644
--- a/vcl/generic/glyphs/graphite_serverfont.cxx
+++ b/vcl/generic/glyphs/graphite_serverfont.cxx
@@ -48,7 +48,7 @@ GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont& rServerFont) thro
, mpFeatures(NULL)
, mpStr(NULL)
{
- gr_font * pFont = rServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight);
+ gr_font * pFont = rServerFont.GetGraphiteFace()->font(rServerFont.GetFontSelData().mnHeight, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
if (!pFont)
{
pFont = gr_make_font_with_advance_fn(
@@ -57,7 +57,7 @@ GraphiteServerFontLayout::GraphiteServerFontLayout(ServerFont& rServerFont) thro
&rServerFont,
freetypeServerFontAdvance,
rServerFont.GetGraphiteFace()->face());
- rServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont);
+ rServerFont.GetGraphiteFace()->addFont(rServerFont.GetFontSelData().mnHeight, pFont, rServerFont.NeedsArtificialBold(), rServerFont.NeedsArtificialItalic());
}
maImpl.SetFont(pFont);
OString aLang("");
diff --git a/vcl/inc/graphite_layout.hxx b/vcl/inc/graphite_layout.hxx
index 6a84d54647fb..c53b55173a0b 100644
--- a/vcl/inc/graphite_layout.hxx
+++ b/vcl/inc/graphite_layout.hxx
@@ -52,7 +52,8 @@ namespace grutils { class GrFeatureParser; }
class GraphiteFaceWrapper
{
public:
- typedef std::map<int, gr_font*> GrFontMap;
+ typedef std::pair<int, int> GrFontMapKey;
+ typedef std::map<GrFontMapKey, gr_font*> GrFontMap;
GraphiteFaceWrapper(gr_face * pFace) : m_pFace(pFace) {}
~GraphiteFaceWrapper()
{
@@ -63,18 +64,21 @@ public:
gr_face_destroy(m_pFace);
}
const gr_face * face() const { return m_pFace; }
- gr_font * font(int ppm) const
+ gr_font * font(int ppm, bool isBold, bool isItalic) const
{
- GrFontMap::const_iterator i = m_fonts.find(ppm);
+ int styleKey = int(isBold) | (int(isItalic) << 1);
+ GrFontMap::const_iterator i = m_fonts.find(GrFontMapKey(ppm, styleKey));
if (i != m_fonts.end())
return i->second;
return NULL;
};
- void addFont(int ppm, gr_font * pFont)
+ void addFont(int ppm, gr_font * pFont, bool isBold, bool isItalic)
{
- if (m_fonts[ppm])
- gr_font_destroy(m_fonts[ppm]);
- m_fonts[ppm] = pFont;
+ int styleKey = int(isBold) | (int(isItalic) << 1);
+ GrFontMapKey key(ppm, styleKey);
+ if (m_fonts[key])
+ gr_font_destroy(m_fonts[key]);
+ m_fonts[key] = pFont;
}
private:
gr_face * m_pFace;