[Libreoffice-commits] core.git: vcl/qt5
Jan-Marek Glogowski (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 11 17:28:02 UTC 2020
vcl/qt5/Qt5Graphics_Text.cxx | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
New commits:
commit 21ebde9189460318c8c04157b48ede9760a600f9
Author: Jan-Marek Glogowski <glogow at fbihome.de>
AuthorDate: Fri Sep 11 16:48:04 2020 +0200
Commit: Jan-Marek Glogowski <glogow at fbihome.de>
CommitDate: Fri Sep 11 19:27:19 2020 +0200
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 at fbihome.de>
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);
More information about the Libreoffice-commits
mailing list