summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/font/PhysicalFontCollection.cxx7
-rw-r--r--vcl/source/font/PhysicalFontFace.cxx40
-rw-r--r--vcl/source/font/PhysicalFontFamily.cxx13
-rw-r--r--vcl/source/font/font.cxx17
-rw-r--r--vcl/source/font/fontattributes.cxx12
-rw-r--r--vcl/source/font/fontmetric.cxx40
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx247
-rw-r--r--vcl/source/gdi/virdev.cxx2
-rw-r--r--vcl/source/outdev/font.cxx12
-rw-r--r--vcl/source/window/window2.cxx16
10 files changed, 78 insertions, 328 deletions
diff --git a/vcl/source/font/PhysicalFontCollection.cxx b/vcl/source/font/PhysicalFontCollection.cxx
index 295de0452eca..3a7da5921b62 100644
--- a/vcl/source/font/PhysicalFontCollection.cxx
+++ b/vcl/source/font/PhysicalFontCollection.cxx
@@ -158,9 +158,6 @@ void PhysicalFontCollection::ImplInitGenericGlyphFallback() const
if( !pFallbackFont )
continue;
- if( !pFallbackFont->IsScalable() )
- continue;
-
// keep the best font of the glyph fallback sub-list
if( nBestQuality < pFallbackFont->GetMinQuality() )
{
@@ -919,7 +916,7 @@ PhysicalFontFamily* PhysicalFontCollection::ImplFindFontFamilyOfDefaultFont() co
return pFoundData;
}
-PhysicalFontCollection* PhysicalFontCollection::Clone( bool bEmbeddable ) const
+PhysicalFontCollection* PhysicalFontCollection::Clone() const
{
PhysicalFontCollection* pClonedCollection = new PhysicalFontCollection;
pClonedCollection->mbMapNames = mbMapNames;
@@ -933,7 +930,7 @@ PhysicalFontCollection* PhysicalFontCollection::Clone( bool bEmbeddable ) const
for(; it != maPhysicalFontFamilies.end(); ++it )
{
const PhysicalFontFamily* pFontFace = (*it).second;
- pFontFace->UpdateCloneFontList( *pClonedCollection, bEmbeddable );
+ pFontFace->UpdateCloneFontList(*pClonedCollection);
}
return pClonedCollection;
diff --git a/vcl/source/font/PhysicalFontFace.cxx b/vcl/source/font/PhysicalFontFace.cxx
index a0fb7210cc9b..044cd36063da 100644
--- a/vcl/source/font/PhysicalFontFace.cxx
+++ b/vcl/source/font/PhysicalFontFace.cxx
@@ -158,45 +158,15 @@ bool PhysicalFontFace::IsBetterMatch( const FontSelectPattern& rFSD, FontMatchSt
nMatch += 600;
}
- if( IsBuiltInFont() )
- nMatch += 1;
-
int nHeightMatch = 0;
int nWidthMatch = 0;
- if( IsScalable() )
- {
- if( rFSD.mnOrientation != 0 )
- nMatch += 80;
- else if( rFSD.mnWidth != 0 )
- nMatch += 25;
- else
- nMatch += 5;
- }
+ if( rFSD.mnOrientation != 0 )
+ nMatch += 80;
+ else if( rFSD.mnWidth != 0 )
+ nMatch += 25;
else
- {
- if( rFSD.mnHeight == mnHeight )
- {
- nMatch += 20;
- if( rFSD.mnWidth == mnWidth )
- nMatch += 10;
- }
- else
- {
- // for non-scalable fonts the size difference is very important
- // prefer the smaller font face because of clipping/overlapping issues
- int nHeightDiff = (rFSD.mnHeight - mnHeight) * 1000;
- nHeightMatch = (nHeightDiff >= 0) ? -nHeightDiff : 100+nHeightDiff;
- if( rFSD.mnHeight )
- nHeightMatch /= rFSD.mnHeight;
-
- if( (rFSD.mnWidth != 0) && (mnWidth != 0) && (rFSD.mnWidth != mnWidth) )
- {
- int nWidthDiff = (rFSD.mnWidth - mnWidth) * 100;
- nWidthMatch = (nWidthDiff >= 0) ? -nWidthDiff : +nWidthDiff;
- }
- }
- }
+ nMatch += 5;
if( rStatus.mnFaceMatch > nMatch )
return false;
diff --git a/vcl/source/font/PhysicalFontFamily.cxx b/vcl/source/font/PhysicalFontFamily.cxx
index e56935c99707..5e28ab37a03f 100644
--- a/vcl/source/font/PhysicalFontFamily.cxx
+++ b/vcl/source/font/PhysicalFontFamily.cxx
@@ -128,8 +128,7 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
}
// set attributes for attribute based font matching
- if( pNewFontFace->IsScalable() )
- mnTypeFaces |= FontTypeFaces::Scalable;
+ mnTypeFaces |= FontTypeFaces::Scalable;
if( pNewFontFace->IsSymbolFont() )
mnTypeFaces |= FontTypeFaces::Symbol;
@@ -173,7 +172,7 @@ bool PhysicalFontFamily::AddFontFace( PhysicalFontFace* pNewFontFace )
return false;
// keep the device font if its quality is good enough
- if( (pNewFontFace->GetQuality() == pFoundFontFace->GetQuality()) && (pFoundFontFace->IsBuiltInFont() || !pNewFontFace->IsBuiltInFont()) )
+ if( pNewFontFace->GetQuality() == pFoundFontFace->GetQuality() )
return false;
// replace existing font face with a better one
@@ -260,8 +259,7 @@ void PhysicalFontFamily::GetFontHeights( std::set<int>& rHeights ) const
}
}
-void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontCollection,
- bool bEmbeddable ) const
+void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollection) const
{
OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
PhysicalFontFamily* pFamily(nullptr);
@@ -270,11 +268,6 @@ void PhysicalFontFamily::UpdateCloneFontList( PhysicalFontCollection& rFontColle
{
PhysicalFontFace *pFoundFontFace = *it;
- if( !pFoundFontFace->IsScalable() )
- continue;
- if( bEmbeddable && !pFoundFontFace->CanEmbed() && !pFoundFontFace->CanSubset() )
- continue;
-
if (!pFamily)
{ // tdf#98989 lazy create as family without faces won't work
pFamily = rFontCollection.FindOrCreateFontFamily(aFamilyName);
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index df0f89165f68..ebf89250d650 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -706,15 +706,6 @@ void Font::DecreaseQualityBy( int nQualityAmount ) { mpImplFont->DecreaseQuality
void Font::SetMapNames( OUString const & aMapNames ) { mpImplFont->SetMapNames(aMapNames); }
-bool Font::IsBuiltInFont() const { return mpImplFont->IsBuiltInFont(); }
-void Font::SetBuiltInFontFlag( bool bIsBuiltInFontFlag ) { mpImplFont->SetBuiltInFontFlag( bIsBuiltInFontFlag ); }
-bool Font::CanEmbed() const { return mpImplFont->CanEmbed(); }
-void Font::SetEmbeddableFlag( bool bEmbeddable ) { mpImplFont->SetEmbeddableFlag( bEmbeddable ); }
-bool Font::CanSubset() const { return mpImplFont->CanSubset(); }
-void Font::SetSubsettableFlag( bool bSubsettable ) { mpImplFont->SetSubsettableFlag( bSubsettable ); }
-bool Font::CanRotate() const { return mpImplFont->CanRotate(); }
-void Font::SetOrientationFlag( bool bCanRotate ) { mpImplFont->SetOrientationFlag( bCanRotate ); }
-
bool Font::IsOutline() const { return mpImplFont->mbOutline; }
bool Font::IsShadow() const { return mpImplFont->mbShadow; }
FontRelief Font::GetRelief() const { return mpImplFont->meRelief; }
@@ -751,10 +742,6 @@ ImplFont::ImplFont() :
maColor( COL_TRANSPARENT ),
maFillColor( COL_TRANSPARENT ),
mbWordLine( false ),
- mbEmbeddable( false ),
- mbSubsettable( false ),
- mbRotatable( false ),
- mbDevice( false ),
mnOrientation( 0 ),
mnQuality( 0 )
{}
@@ -788,10 +775,6 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) :
maFillColor( rImplFont.maFillColor ),
maMapNames( rImplFont.maMapNames ),
mbWordLine( rImplFont.mbWordLine ),
- mbEmbeddable( rImplFont.mbEmbeddable ),
- mbSubsettable( rImplFont.mbSubsettable ),
- mbRotatable( rImplFont.mbRotatable ),
- mbDevice( rImplFont.mbDevice ),
mnOrientation( rImplFont.mnOrientation ),
mnQuality( rImplFont.mnQuality )
{}
diff --git a/vcl/source/font/fontattributes.cxx b/vcl/source/font/fontattributes.cxx
index f800f18fce0c..890f4f20b2d8 100644
--- a/vcl/source/font/fontattributes.cxx
+++ b/vcl/source/font/fontattributes.cxx
@@ -30,11 +30,7 @@ FontAttributes::FontAttributes()
meItalic ( ITALIC_NONE ),
meCharSet( RTL_TEXTENCODING_DONTKNOW ),
mbSymbolFlag( false ),
- mnQuality( 0 ),
- mbOrientation( false ),
- mbDevice( false ),
- mbSubsettable( false ),
- mbEmbeddable ( false )
+ mnQuality( 0 )
{}
FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) :
@@ -48,11 +44,7 @@ FontAttributes::FontAttributes( const FontAttributes& rFontAttributes ) :
meCharSet( rFontAttributes.meCharSet ),
mbSymbolFlag( rFontAttributes.mbSymbolFlag ),
maMapNames( rFontAttributes.maMapNames ),
- mnQuality( rFontAttributes.mnQuality ),
- mbOrientation( rFontAttributes.mbOrientation ),
- mbDevice( rFontAttributes.mbDevice ),
- mbSubsettable( rFontAttributes.mbSubsettable ),
- mbEmbeddable( rFontAttributes.mbEmbeddable )
+ mnQuality( rFontAttributes.mnQuality )
{}
bool FontAttributes::CompareDeviceIndependentFontAttributes(const FontAttributes& rOther) const
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index b48b0aaca348..42d8ea593a5a 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -74,11 +74,6 @@ bool FontMetric::operator==( const FontMetric& rFontMetric ) const
return false;
}
-FontType FontMetric::GetType() const
-{
- return (mxImplMetric->IsScalable() ? TYPE_SCALABLE : TYPE_RASTER);
-}
-
long FontMetric::GetAscent() const
{
return mxImplMetric->GetAscent();
@@ -149,16 +144,6 @@ void FontMetric::SetBulletOffset( long nOffset )
mxImplMetric->SetBulletOffset( nOffset );
}
-bool FontMetric::IsScalable() const
-{
- return mxImplMetric->IsScalable();
-}
-
-void FontMetric::SetScalableFlag(bool bScalable)
-{
- mxImplMetric->SetScalableFlag( bScalable );
-}
-
bool FontMetric::IsFullstopCentered() const
{
return mxImplMetric->IsFullstopCentered();
@@ -169,16 +154,6 @@ void FontMetric::SetFullstopCenteredFlag(bool bScalable)
mxImplMetric->SetFullstopCenteredFlag( bScalable );
}
-bool FontMetric::IsBuiltInFont() const
-{
- return mxImplMetric->IsBuiltInFont();
-}
-
-void FontMetric::SetBuiltInFontFlag( bool bIsBuiltInFont )
-{
- mxImplMetric->SetBuiltInFontFlag( bIsBuiltInFont );
-}
-
ImplFontMetric::ImplFontMetric()
: mnAscent( 0 ),
@@ -188,16 +163,12 @@ ImplFontMetric::ImplFontMetric()
mnLineHeight( 0 ),
mnSlant( 0 ),
mnBulletOffset( 0 ),
- mbScalableFont( false ),
- mbFullstopCentered( false ),
- mbDevice( false )
+ mbFullstopCentered( false )
{}
bool ImplFontMetric::operator==( const ImplFontMetric& r ) const
{
- if( mbScalableFont != r.mbScalableFont
- || mbFullstopCentered != r.mbFullstopCentered
- || mbDevice != r.mbDevice) // mbDevice == built-in font flag
+ if (mbFullstopCentered != r.mbFullstopCentered)
return false;
if( mnAscent != r.mnAscent )
return false;
@@ -224,9 +195,6 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
, mnExtLeading( 0 )
, mnSlant( 0 )
, mnMinKashida( 0 )
- , mbScalableFont( false )
- , mbTrueTypeFont( false )
- , mbKernableFont( false )
, mbFullstopCentered( false )
, mnBulletOffset( 0 )
, mnUnderlineSize( 0 )
@@ -260,16 +228,12 @@ ImplFontMetricData::ImplFontMetricData( const FontSelectPattern& rFontSelData )
{
SetFamilyName( rFontSelData.mpFontData->GetFamilyName() );
SetStyleName( rFontSelData.mpFontData->GetStyleName() );
- SetBuiltInFontFlag( rFontSelData.mpFontData->IsBuiltInFont() );
- SetKernableFlag( true );
}
else
{
sal_Int32 nTokenPos = 0;
SetFamilyName( GetNextFontToken( rFontSelData.GetFamilyName(), nTokenPos ) );
SetStyleName( rFontSelData.GetStyleName() );
- SetBuiltInFontFlag( false );
- SetKernableFlag( false );
}
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index f667f12f0c91..76f43382ebb6 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2243,11 +2243,7 @@ static FontAttributes GetDevFontAttributes( const PDFWriterImpl::BuiltinFont& rB
aDFA.SetItalic( rBuiltin.m_eItalic );
aDFA.SetWidthType( rBuiltin.m_eWidthType );
- aDFA.SetOrientationFlag( true );
- aDFA.SetBuiltInFontFlag( true );
aDFA.SetQuality( 50000 );
- aDFA.SetSubsettableFlag( false );
- aDFA.SetEmbeddableFlag( false );
return aDFA;
}
@@ -2947,63 +2943,34 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFo
assert(pGraphics);
- if( pFont->CanEmbed() )
- {
- const unsigned char* pFontData = nullptr;
- long nFontLen = 0;
- sal_Ucs nEncodedCodes[256];
- sal_Int32 pEncWidths[256];
-
- //TODO: surely this is utterly broken because GetEmbedFontData loops over the uninitialized nEncodedCodes as input
- pFontData = static_cast<const unsigned char*>(pGraphics->GetEmbedFontData( pFont, nEncodedCodes, pEncWidths, 256, aInfo, &nFontLen ));
+ aSubType = OString( "/TrueType" );
+ std::vector< sal_Int32 > aGlyphWidths;
+ Ucs2UIntMap aUnicodeMap;
+ pGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap );
- if( pFontData )
- {
- pGraphics->FreeEmbedFontData( pFontData, nFontLen );
- for( int i = 0; i < 256; i++ )
- {
- if( nEncodedCodes[i] >= 32 && nEncodedCodes[i] < 256 )
- {
- pWidths[i] = pEncWidths[ i ];
- }
- }
- }
- }
- else if( pFont->CanSubset() )
- {
- aSubType = OString( "/TrueType" );
- std::vector< sal_Int32 > aGlyphWidths;
- Ucs2UIntMap aUnicodeMap;
- pGraphics->GetGlyphWidths( pFont, false, aGlyphWidths, aUnicodeMap );
-
- OUString aTmpName;
- osl_createTempFile( nullptr, nullptr, &aTmpName.pData );
- sal_GlyphId aGlyphIds[ 256 ];
- sal_uInt8 pEncoding[ 256 ];
- sal_Int32 pDuWidths[ 256 ];
-
- memset( aGlyphIds, 0, sizeof( aGlyphIds ) );
- memset( pEncoding, 0, sizeof( pEncoding ) );
- memset( pDuWidths, 0, sizeof( pDuWidths ) );
-
- for( sal_Ucs c = 32; c < 256; c++ )
- {
- pEncoding[c] = c;
- aGlyphIds[c] = 0;
- if( aUnicodeMap.find( c ) != aUnicodeMap.end() )
- pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ];
- }
- //TODO: surely this is utterly broken because aGlyphIds is just all zeros, if we
- //had the right glyphids here then I imagine we could replace pDuWidths with
- //pWidths and remove pWidths assignment above. i.e. start with the glyph ids
- //and map those to unicode rather than try and reverse map them ?
- pGraphics->CreateFontSubset( aTmpName, pFont, aGlyphIds, pEncoding, pDuWidths, 256, aInfo );
- osl_removeFile( aTmpName.pData );
- }
- else
- {
- OSL_FAIL( "system font neither embeddable nor subsettable" );
- }
+ OUString aTmpName;
+ osl_createTempFile( nullptr, nullptr, &aTmpName.pData );
+ sal_GlyphId aGlyphIds[ 256 ];
+ sal_uInt8 pEncoding[ 256 ];
+ sal_Int32 pDuWidths[ 256 ];
+
+ memset( aGlyphIds, 0, sizeof( aGlyphIds ) );
+ memset( pEncoding, 0, sizeof( pEncoding ) );
+ memset( pDuWidths, 0, sizeof( pDuWidths ) );
+
+ for( sal_Ucs c = 32; c < 256; c++ )
+ {
+ pEncoding[c] = c;
+ aGlyphIds[c] = 0;
+ if( aUnicodeMap.find( c ) != aUnicodeMap.end() )
+ pWidths[ c ] = aGlyphWidths[ aUnicodeMap[ c ] ];
+ }
+ //TODO: surely this is utterly broken because aGlyphIds is just all zeros, if we
+ //had the right glyphids here then I imagine we could replace pDuWidths with
+ //pWidths and remove pWidths assignment above. i.e. start with the glyph ids
+ //and map those to unicode rather than try and reverse map them ?
+ pGraphics->CreateFontSubset( aTmpName, pFont, aGlyphIds, pEncoding, pDuWidths, 256, aInfo );
+ osl_removeFile( aTmpName.pData );
// write font descriptor
nFontDescriptor = emitFontDescriptor( pFont, aInfo, 0, 0 );
@@ -8919,139 +8886,47 @@ void PDFWriterImpl::registerGlyphs( int nGlyphs,
const int nFontGlyphId = pGlyphs[i] & (GF_IDXMASK | GF_ISCHAR | GF_GSUB);
const PhysicalFontFace* pCurrentFont = pFallbackFonts[i] ? pFallbackFonts[i] : pDevFont;
- if( pCurrentFont->CanSubset() )
+ FontSubset& rSubset = m_aSubsets[ pCurrentFont ];
+ // search for font specific glyphID
+ FontMapping::iterator it = rSubset.m_aMapping.find( nFontGlyphId );
+ if( it != rSubset.m_aMapping.end() )
{
- FontSubset& rSubset = m_aSubsets[ pCurrentFont ];
- // search for font specific glyphID
- FontMapping::iterator it = rSubset.m_aMapping.find( nFontGlyphId );
- if( it != rSubset.m_aMapping.end() )
- {
- pMappedFontObjects[i] = it->second.m_nFontID;
- pMappedGlyphs[i] = it->second.m_nSubsetGlyphID;
- }
- else
- {
- // create new subset if necessary
- if( rSubset.m_aSubsets.empty()
- || (rSubset.m_aSubsets.back().m_aMapping.size() > 254) )
- {
- rSubset.m_aSubsets.push_back( FontEmit( m_nNextFID++ ) );
- }
-
- // copy font id
- pMappedFontObjects[i] = rSubset.m_aSubsets.back().m_nFontID;
- // create new glyph in subset
- sal_uInt8 nNewId = sal::static_int_cast<sal_uInt8>(rSubset.m_aSubsets.back().m_aMapping.size()+1);
- pMappedGlyphs[i] = nNewId;
-
- // add new glyph to emitted font subset
- GlyphEmit& rNewGlyphEmit = rSubset.m_aSubsets.back().m_aMapping[ nFontGlyphId ];
- rNewGlyphEmit.setGlyphId( nNewId );
- for( sal_Int32 n = 0; n < pUnicodesPerGlyph[i]; n++ )
- rNewGlyphEmit.addCode( pCurUnicode[n] );
-
- // add new glyph to font mapping
- Glyph& rNewGlyph = rSubset.m_aMapping[ nFontGlyphId ];
- rNewGlyph.m_nFontID = pMappedFontObjects[i];
- rNewGlyph.m_nSubsetGlyphID = nNewId;
- }
- if (!getReferenceDevice()->AcquireGraphics())
- return;
- const bool bVertical = ((pGlyphs[i] & GF_ROTMASK) != 0);
- pGlyphWidths[i] = m_aFontCache.getGlyphWidth( pCurrentFont,
- nFontGlyphId,
- bVertical,
- pGraphics );
- }
- else if( pCurrentFont->CanEmbed() )
- {
- sal_Int32 nFontID = 0;
- FontEmbedData::iterator it = m_aEmbeddedFonts.find( pCurrentFont );
- if( it != m_aEmbeddedFonts.end() )
- nFontID = it->second.m_nNormalFontID;
- else
+ pMappedFontObjects[i] = it->second.m_nFontID;
+ pMappedGlyphs[i] = it->second.m_nSubsetGlyphID;
+ }
+ else
+ {
+ // create new subset if necessary
+ if( rSubset.m_aSubsets.empty()
+ || (rSubset.m_aSubsets.back().m_aMapping.size() > 254) )
{
- nFontID = m_nNextFID++;
- m_aEmbeddedFonts[ pCurrentFont ] = EmbedFont();
- m_aEmbeddedFonts[ pCurrentFont ].m_nNormalFontID = nFontID;
+ rSubset.m_aSubsets.push_back( FontEmit( m_nNextFID++ ) );
}
- EmbedFont& rEmbedFont = m_aEmbeddedFonts[pCurrentFont];
-
- const Ucs2SIntMap* pEncoding = nullptr;
- const Ucs2OStrMap* pNonEncoded = nullptr;
- if (!getReferenceDevice()->AcquireGraphics())
- return;
- pEncoding = pGraphics->GetFontEncodingVector( pCurrentFont, &pNonEncoded, nullptr);
- Ucs2SIntMap::const_iterator enc_it;
- Ucs2OStrMap::const_iterator nonenc_it;
+ // copy font id
+ pMappedFontObjects[i] = rSubset.m_aSubsets.back().m_nFontID;
+ // create new glyph in subset
+ sal_uInt8 nNewId = sal::static_int_cast<sal_uInt8>(rSubset.m_aSubsets.back().m_aMapping.size()+1);
+ pMappedGlyphs[i] = nNewId;
- sal_Int32 nCurFontID = nFontID;
- sal_Ucs cChar = *pCurUnicode;
- if( pEncoding )
- {
- enc_it = pEncoding->find( cChar );
- if( enc_it != pEncoding->end() && enc_it->second > 0 )
- {
- SAL_WARN_IF( (enc_it->second & 0xffffff00) != 0, "vcl", "Invalid character code" );
- cChar = (sal_Ucs)enc_it->second;
- }
- else if( (enc_it == pEncoding->end() || enc_it->second == -1) &&
- pNonEncoded &&
- (nonenc_it = pNonEncoded->find( cChar )) != pNonEncoded->end() )
- {
- nCurFontID = 0;
- // find non encoded glyph
- for( std::list< EmbedEncoding >::iterator nec_it = rEmbedFont.m_aExtendedEncodings.begin(); nec_it != rEmbedFont.m_aExtendedEncodings.end(); ++nec_it )
- {
- if( nec_it->m_aCMap.find( cChar ) != nec_it->m_aCMap.end() )
- {
- nCurFontID = nec_it->m_nFontID;
- cChar = (sal_Ucs)nec_it->m_aCMap[ cChar ];
- break;
- }
- }
- if( nCurFontID == 0 ) // new nonencoded glyph
- {
- if( rEmbedFont.m_aExtendedEncodings.empty() || rEmbedFont.m_aExtendedEncodings.back().m_aEncVector.size() == 255 )
- {
- rEmbedFont.m_aExtendedEncodings.push_back( EmbedEncoding() );
- rEmbedFont.m_aExtendedEncodings.back().m_nFontID = m_nNextFID++;
- }
- EmbedEncoding& rEncoding = rEmbedFont.m_aExtendedEncodings.back();
- rEncoding.m_aEncVector.push_back( EmbedCode() );
- rEncoding.m_aEncVector.back().m_aUnicode = cChar;
- rEncoding.m_aEncVector.back().m_aName = nonenc_it->second;
- rEncoding.m_aCMap[ cChar ] = (sal_Int8)(rEncoding.m_aEncVector.size()-1);
- nCurFontID = rEncoding.m_nFontID;
- cChar = (sal_Ucs)rEncoding.m_aCMap[ cChar ];
- }
- }
- else
- pEncoding = nullptr;
- }
- if( ! pEncoding )
- {
- if( cChar & 0xff00 )
- {
- // some characters can be used by conversion
- if( cChar >= 0xf000 && cChar <= 0xf0ff ) // symbol encoding in private use area
- cChar -= 0xf000;
- else
- {
- OString aChar(&cChar, 1, RTL_TEXTENCODING_MS_1252);
- cChar = !aChar.isEmpty() ? (static_cast<sal_Ucs>(aChar[0]) & 0x00ff) : 0;
- }
- }
- }
+ // add new glyph to emitted font subset
+ GlyphEmit& rNewGlyphEmit = rSubset.m_aSubsets.back().m_aMapping[ nFontGlyphId ];
+ rNewGlyphEmit.setGlyphId( nNewId );
+ for( sal_Int32 n = 0; n < pUnicodesPerGlyph[i]; n++ )
+ rNewGlyphEmit.addCode( pCurUnicode[n] );
- pMappedGlyphs[ i ] = (sal_Int8)cChar;
- pMappedFontObjects[ i ] = nCurFontID;
- pGlyphWidths[ i ] = m_aFontCache.getGlyphWidth( pCurrentFont,
- (pEncoding ? *pCurUnicode : cChar) | GF_ISCHAR,
- false,
- pGraphics );
+ // add new glyph to font mapping
+ Glyph& rNewGlyph = rSubset.m_aMapping[ nFontGlyphId ];
+ rNewGlyph.m_nFontID = pMappedFontObjects[i];
+ rNewGlyph.m_nSubsetGlyphID = nNewId;
}
+ if (!getReferenceDevice()->AcquireGraphics())
+ return;
+ const bool bVertical = ((pGlyphs[i] & GF_ROTMASK) != 0);
+ pGlyphWidths[i] = m_aFontCache.getGlyphWidth( pCurrentFont,
+ nFontGlyphId,
+ bVertical,
+ pGraphics );
}
}
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index c174aca6b77a..61cf67e7491e 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -518,7 +518,7 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32
// get font list with scalable fonts only
AcquireGraphics();
- mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone( false );
+ mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
// prepare to use new font lists
mpFontCache = new ImplFontCache();
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index 8edcb9a1501a..c30d4231da63 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -55,8 +55,6 @@ FontMetric OutputDevice::GetDevFont( int nDevFontIndex ) const
aFontMetric.SetItalic( rData.GetItalic() );
aFontMetric.SetAlignment( TextAlign::ALIGN_TOP );
aFontMetric.SetWidthType( rData.GetWidthType() );
- aFontMetric.SetScalableFlag( rData.IsScalable() );
- aFontMetric.SetBuiltInFontFlag( rData.IsBuiltInFont() );
aFontMetric.SetQuality( rData.GetQuality() );
aFontMetric.SetMapNames( rData.GetMapNames() );
}
@@ -194,12 +192,8 @@ FontMetric OutputDevice::GetFontMetric() const
aMetric.SetOrientation( pFontInstance->mnOwnOrientation );
else
aMetric.SetOrientation( xFontMetric->GetOrientation() );
- if( !pFontInstance->mxFontMetric->IsKernable() )
- aMetric.SetKerning( maFont.GetKerning() & ~FontKerning::FontSpecific );
// set remaining metric fields
- aMetric.SetBuiltInFontFlag( xFontMetric->IsBuiltInFont() );
- aMetric.SetScalableFlag( xFontMetric->IsScalable() );
aMetric.SetFullstopCenteredFlag( xFontMetric->IsFullstopCentered() );
aMetric.SetBulletOffset( xFontMetric->GetBulletOffset() );
aMetric.SetAscent( ImplDevicePixelToLogicHeight( xFontMetric->GetAscent() + mnEmphasisAscent ) );
@@ -572,7 +566,7 @@ void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
{
if( mpPDFWriter )
{
- mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone( true );
+ mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone();
mpFontCache = new ImplFontCache();
}
else
@@ -1116,9 +1110,7 @@ bool OutputDevice::ImplNewFont() const
// enable kerning array if requested
if ( maFont.GetKerning() & FontKerning::FontSpecific )
{
- // TODO: test if physical font supports kerning and disable if not
- if( pFontInstance->mxFontMetric->IsKernable() )
- mbKerning = true;
+ mbKerning = true;
}
else
{
diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx
index dd68e0b8647d..8e3d2dc0d212 100644
--- a/vcl/source/window/window2.cxx
+++ b/vcl/source/window/window2.cxx
@@ -459,22 +459,6 @@ void Window::SetZoomedPointFont(vcl::RenderContext& rRenderContext, const vcl::F
aSize.Height() = WinFloatRound(n);
aFont.SetFontSize(aSize);
SetPointFont(rRenderContext, aFont);
-
- // Use another font if the representation is to be scaled,
- // and the actual font is not scalable
- FontMetric aMetric = rRenderContext.GetFontMetric();
- long nFontDiff = std::abs(rRenderContext.GetFont().GetFontSize().Height() - aMetric.GetFontSize().Height());
- if ((aMetric.GetType() == TYPE_RASTER) && (nFontDiff >= 2))
- {
- DefaultFontType nType;
- if (aMetric.GetPitch() == PITCH_FIXED)
- nType = DefaultFontType::FIXED;
- else
- nType = DefaultFontType::UI_SANS;
- vcl::Font aTempFont = OutputDevice::GetDefaultFont(nType, rRenderContext.GetSettings().GetLanguageTag().getLanguageType(), GetDefaultFontFlags::NONE);
- aFont.SetFamilyName(aTempFont.GetFamilyName());
- SetPointFont(rRenderContext, aFont);
- }
}
else
{