vcl/source/fontsubset/sft.cxx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
New commits: commit 88e82c0f37b9fd362fe0cacba32442149eb3afaa Author: Caolán McNamara <[email protected]> AuthorDate: Thu Mar 3 09:35:08 2022 +0000 Commit: Caolán McNamara <[email protected]> CommitDate: Thu Mar 3 13:44:02 2022 +0100 rearrange slightly to have one pair of reads no logic change intended Change-Id: I2c102d8fea89ae68b75cb22b32f77fc90843b079 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130910 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index bfdc28f1d79b..7a77d1961a6d 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2230,14 +2230,19 @@ GlyphData *GetTTRawGlyphData(AbstractTrueTypeFont *ttf, sal_uInt32 glyphID) } /* get advance width and left sidebearing */ + sal_uInt32 nAwOffset; + sal_uInt32 nLsboffset; if (glyphID < ttf->horzMetricCount()) { - d->aw = GetUInt16(hmtx, 4 * glyphID); - d->lsb = GetInt16(hmtx, 4 * glyphID + 2); + nAwOffset = 4 * glyphID; + nLsboffset = 4 * glyphID + 2; } else { - d->aw = GetUInt16(hmtx, 4 * (ttf->horzMetricCount() - 1)); - d->lsb = GetInt16(hmtx + ttf->horzMetricCount() * 4, (glyphID - ttf->horzMetricCount()) * 2); + nAwOffset = 4 * (ttf->horzMetricCount() - 1); + nLsboffset = (ttf->horzMetricCount() * 4) + ((glyphID - ttf->horzMetricCount()) * 2); } + d->aw = GetUInt16(hmtx, nAwOffset); + d->lsb = GetInt16(hmtx, nLsboffset); + return d; }
