summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMark Hung <marklh9@gmail.com>2016-01-13 23:08:37 +0800
committerCaolán McNamara <caolanm@redhat.com>2016-02-18 09:41:11 +0000
commit775d93d0c0dc902dab6e3bdb978501b5d6295f8b (patch)
tree1407685deba170f4ed57a96490ad70691c1dd715 /vcl
parentd2f33d22836621506adec6814abf010fa2d683e6 (diff)
tdf#96091 Correct ascend and descend values for OTC font.
CffSubsetterContext::emitAsType1() calculate ascend and descend when emitting PDF font descriptor based on bounding box values. However, values can come directly from hhea or OS2 table are better for OTC font. The order that determines which ascend and descend values are used in PrintFontManager::analyzeTrueTypeFile() is changed in order to make winAscend/winDescend and bounding box based values the last choice. Change-Id: I421f6af6a4bee01d23ccf3e8e65c8f6ad80922b6 Reviewed-on: https://gerrit.libreoffice.org/21444 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/unx/generic/fontmanager/fontmanager.cxx23
1 files changed, 15 insertions, 8 deletions
diff --git a/vcl/unx/generic/fontmanager/fontmanager.cxx b/vcl/unx/generic/fontmanager/fontmanager.cxx
index ffa7f9756e12..d8863a4cb114 100644
--- a/vcl/unx/generic/fontmanager/fontmanager.cxx
+++ b/vcl/unx/generic/fontmanager/fontmanager.cxx
@@ -1294,11 +1294,11 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const
pFont->m_aGlobalMetricY.width = pFont->m_aGlobalMetricX.width = aInfo.xMax - aInfo.xMin;
pFont->m_aGlobalMetricY.height = pFont->m_aGlobalMetricX.height = aInfo.yMax - aInfo.yMin;
- if( aInfo.winAscent && aInfo.winDescent )
+ if( aInfo.ascender && aInfo.descender )
{
- pFont->m_nAscend = aInfo.winAscent;
- pFont->m_nDescend = aInfo.winDescent;
- pFont->m_nLeading = pFont->m_nAscend + pFont->m_nDescend - 1000;
+ pFont->m_nLeading = aInfo.linegap;
+ pFont->m_nAscend = aInfo.ascender;
+ pFont->m_nDescend = -aInfo.descender;
}
else if( aInfo.typoAscender && aInfo.typoDescender )
{
@@ -1306,11 +1306,11 @@ bool PrintFontManager::analyzeTrueTypeFile( PrintFont* pFont ) const
pFont->m_nAscend = aInfo.typoAscender;
pFont->m_nDescend = -aInfo.typoDescender;
}
- else
+ else if( aInfo.winAscent && aInfo.winDescent )
{
- pFont->m_nLeading = aInfo.linegap;
- pFont->m_nAscend = aInfo.ascender;
- pFont->m_nDescend = -aInfo.descender;
+ pFont->m_nAscend = aInfo.winAscent;
+ pFont->m_nDescend = aInfo.winDescent;
+ pFont->m_nLeading = pFont->m_nAscend + pFont->m_nDescend - 1000;
}
// last try: font bounding box
@@ -2012,6 +2012,13 @@ bool PrintFontManager::createFontSubset(
pOutFile, pGlyphSetName,
aRequestedGlyphIds, pEnc, nGlyphs, pWidths );
fclose( pOutFile );
+ // For OTC, values from hhea or OS2 are better
+ psp::PrintFontInfo aFontInfo;
+ if( getFontInfo( nFont, aFontInfo ) )
+ {
+ rInfo.m_nAscent = aFontInfo.m_nAscend;
+ rInfo.m_nDescent = -aFontInfo.m_nDescend;
+ }
// cleanup before early return
CloseTTFont( pTTFont );
return bOK;