summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan-Marek Glogowski <glogow@fbihome.de>2020-09-11 16:48:04 +0200
committerJan-Marek Glogowski <glogow@fbihome.de>2020-09-11 19:27:19 +0200
commit21ebde9189460318c8c04157b48ede9760a600f9 (patch)
treeebe761459459bd2d770806e18fdf1cd4c0d1c079 /vcl
parent4108665b63ab432732b8b351568c255d872cc3ff (diff)
tdf#125234 Qt use glyph widths, not advance
We're working on the font level here, not the layouting. So use LO's TTF functions to read the glyph widths of the font directly. Change-Id: Ib3bd59a91aa08ca9e629a45ba7539d757bef2c1a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102488 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/qt5/Qt5Graphics_Text.cxx17
1 files changed, 7 insertions, 10 deletions
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 8ee299debfd0..a42d35ae6391 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -240,7 +240,6 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa
sal_uInt16 aShortIDs[nGlyphCount + 1];
sal_uInt8 aTempEncs[nGlyphCount + 1];
- quint32 aQtGlyphId[nGlyphCount + 1];
int nNotDef = -1;
@@ -250,7 +249,6 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa
sal_GlyphId aGlyphId(pGlyphIds[i]);
aShortIDs[i] = static_cast<sal_uInt16>(aGlyphId);
- aQtGlyphId[i] = aShortIDs[i];
if (!aGlyphId && nNotDef < 0)
nNotDef = i; // first NotDef glyph found
}
@@ -263,22 +261,21 @@ bool Qt5Graphics::CreateFontSubset(const OUString& rToFile, const PhysicalFontFa
// NotDef glyph must be in pos 0 => swap glyphids
aShortIDs[nNotDef] = aShortIDs[0];
aTempEncs[nNotDef] = aTempEncs[0];
- aQtGlyphId[nNotDef] = aQtGlyphId[0];
aShortIDs[0] = 0;
aTempEncs[0] = 0;
- aQtGlyphId[0] = 0;
}
- QPointF anAdvanceList[nGlyphCount];
- if (!aRawFont.advancesForGlyphIndexes(aQtGlyphId, anAdvanceList, nGlyphCount))
+ std::unique_ptr<sal_uInt16[]> pGlyphMetrics
+ = GetTTSimpleGlyphMetrics(&aTTF, aShortIDs, nGlyphCount, false);
+ if (!pGlyphMetrics)
return false;
- QPointF nNotDefAdv = anAdvanceList[0];
- anAdvanceList[0] = anAdvanceList[nNotDef];
- anAdvanceList[nNotDef] = nNotDefAdv;
+ sal_uInt16 nNotDefAdv = pGlyphMetrics[0];
+ pGlyphMetrics[0] = pGlyphMetrics[nNotDef];
+ pGlyphMetrics[nNotDef] = nNotDefAdv;
for (int i = 0; i < nOrigGlyphCount; ++i)
- pGlyphWidths[i] = round(anAdvanceList[i].x());
+ pGlyphWidths[i] = pGlyphMetrics[i];
// write subset into destination file
Qt5TrueTypeFont aTTF(aRawFont);