summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Hosny <khaledhosny@eglug.org>2016-11-29 08:34:29 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-12-06 20:41:37 -0500
commit40b1cadc63523a3b3269838748f47d5ac251877e (patch)
tree6e3b898a75f6af5c9e43e67c49c98e71969739a6
parent4017309721bd3e0439246c3d63afec809d40b81a (diff)
Drop a bunch of font metrics flags
These flags mean nothing these days, there are either always true or always false, since we no longer support bitmap or Type 1 fonts. Change-Id: Ie14ca480225a6346d868a44e58e7666c3a06931d Reviewed-on: https://gerrit.libreoffice.org/31346 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Khaled Hosny <khaledhosny@eglug.org> (cherry picked from commit 74314b11a4b5a2887bd1ff19bdcfb3572b09240c)
-rw-r--r--chart2/source/controller/drawinglayer/ViewElementListProvider.cxx3
-rw-r--r--include/svtools/ctrltool.hxx6
-rw-r--r--include/tools/fontenum.hxx3
-rw-r--r--include/vcl/font.hxx10
-rw-r--r--include/vcl/metric.hxx6
-rw-r--r--sc/source/ui/docshell/docsh3.cxx2
-rw-r--r--sd/source/ui/animations/CustomAnimationDialog.cxx2
-rw-r--r--sd/source/ui/docshell/docshel4.cxx2
-rw-r--r--svtools/source/control/ctrltool.cxx25
-rw-r--r--vcl/inc/PhysicalFontCollection.hxx2
-rw-r--r--vcl/inc/PhysicalFontFace.hxx1
-rw-r--r--vcl/inc/PhysicalFontFamily.hxx4
-rw-r--r--vcl/inc/fontattributes.hxx12
-rw-r--r--vcl/inc/impfont.hxx16
-rw-r--r--vcl/inc/impfontmetric.hxx6
-rw-r--r--vcl/inc/impfontmetricdata.hxx9
-rw-r--r--vcl/qa/cppunit/font.cxx50
-rw-r--r--vcl/qa/cppunit/fontmetric.cxx38
-rw-r--r--vcl/quartz/ctfonts.cxx11
-rw-r--r--vcl/quartz/salgdi.cxx10
-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
-rw-r--r--vcl/unx/generic/glyphs/freetype_glyphcache.cxx6
-rw-r--r--vcl/unx/generic/print/genpspgraphics.cxx5
-rw-r--r--vcl/win/gdi/salfont.cxx199
33 files changed, 143 insertions, 691 deletions
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
index a4af2d83ff33..bebf04e8db03 100644
--- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
+++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx
@@ -192,8 +192,7 @@ FontList* ViewElementListProvider::getFontList() const
OutputDevice* pRefDev = m_pDrawModelWrapper ? m_pDrawModelWrapper->getReferenceDevice() : nullptr;
OutputDevice* pDefaultOut = Application::GetDefaultDevice();
m_pFontList = new FontList( pRefDev ? pRefDev : pDefaultOut
- , pRefDev ? pDefaultOut : nullptr
- , false );
+ , pRefDev ? pDefaultOut : nullptr);
}
return m_pFontList;
}
diff --git a/include/svtools/ctrltool.hxx b/include/svtools/ctrltool.hxx
index 7e2ec66fae84..48196a0169ea 100644
--- a/include/svtools/ctrltool.hxx
+++ b/include/svtools/ctrltool.hxx
@@ -152,13 +152,11 @@ private:
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFind( const OUString& rSearchName, sal_uLong* pIndex ) const;
SVT_DLLPRIVATE ImplFontListNameInfo* ImplFindByName( const OUString& rStr ) const;
- SVT_DLLPRIVATE void ImplInsertFonts( OutputDevice* pDev, bool bAll,
- bool bInsertData );
+ SVT_DLLPRIVATE void ImplInsertFonts(OutputDevice* pDev, bool bInsertData);
public:
FontList( OutputDevice* pDevice,
- OutputDevice* pDevice2 = nullptr,
- bool bAll = true );
+ OutputDevice* pDevice2 = nullptr);
~FontList();
FontList* Clone() const;
diff --git a/include/tools/fontenum.hxx b/include/tools/fontenum.hxx
index ce5736b192d1..eeb35be1985c 100644
--- a/include/tools/fontenum.hxx
+++ b/include/tools/fontenum.hxx
@@ -75,9 +75,6 @@ namespace o3tl
}
-enum FontType { TYPE_DONTKNOW, TYPE_RASTER, TYPE_VECTOR, TYPE_SCALABLE,
- FontType_FORCE_EQUAL_SIZE=SAL_MAX_ENUM };
-
enum FontEmbeddedBitmap { EMBEDDEDBITMAP_DONTKNOW, EMBEDDEDBITMAP_FALSE, EMBEDDEDBITMAP_TRUE };
enum FontAntiAlias { ANTIALIAS_DONTKNOW, ANTIALIAS_FALSE, ANTIALIAS_TRUE };
diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 9e0a637c85c1..2dc0a5b326cd 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -87,21 +87,11 @@ public:
// Device dependent functions
int GetQuality() const;
- bool IsBuiltInFont() const;
- bool CanEmbed() const;
- bool CanSubset() const;
- bool CanRotate() const;
-
void SetQuality(int);
void IncreaseQualityBy(int);
void DecreaseQualityBy(int);
void SetMapNames(OUString const &);
- void SetBuiltInFontFlag(bool);
- void SetEmbeddableFlag(bool);
- void SetSubsettableFlag(bool);
- void SetOrientationFlag(bool);
-
// setting the color on the font is obsolete, the only remaining
// valid use is for keeping backward compatibility with old MetaFiles
const Color& GetColor() const;
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index 22c28496f58d..3709364a0b5c 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -38,8 +38,6 @@ public:
FontMetric( const FontMetric& ); // TODO make this explicit
virtual ~FontMetric() override;
- FontType GetType() const;
-
long GetAscent() const;
long GetDescent() const;
long GetInternalLeading() const;
@@ -56,13 +54,9 @@ public:
void SetSlant(long);
void SetBulletOffset(long);
- bool IsScalable() const;
bool IsFullstopCentered() const;
- bool IsBuiltInFont() const;
- void SetScalableFlag(bool);
void SetFullstopCenteredFlag(bool);
- void SetBuiltInFontFlag(bool);
FontMetric& operator=( const FontMetric& rMetric );
FontMetric& operator=( FontMetric&& rMetric );
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 6dd859031c70..9963f9824a2a 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -454,7 +454,7 @@ void ScDocShell::UpdateFontList()
{
delete pImpl->pFontList;
// pImpl->pFontList = new FontList( GetPrinter(), Application::GetDefaultDevice() );
- pImpl->pFontList = new FontList( GetRefDevice(), nullptr, false ); // sal_False or sal_True???
+ pImpl->pFontList = new FontList(GetRefDevice(), nullptr);
SvxFontListItem aFontListItem( pImpl->pFontList, SID_ATTR_CHAR_FONTLIST );
PutItem( aFontListItem );
diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx
index ef4169836c9f..f9aa985b59a2 100644
--- a/sd/source/ui/animations/CustomAnimationDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationDialog.cxx
@@ -280,7 +280,7 @@ FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent,
if(!pFontList)
{
- pFontList = new FontList( Application::GetDefaultDevice(), nullptr, false );
+ pFontList = new FontList(Application::GetDefaultDevice(), nullptr);
bMustDelete = true;
}
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 395bda129fa2..a94c79ea4126 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -163,7 +163,7 @@ void DrawDocShell::UpdateFontList()
pRefDevice = GetPrinter(true);
else
pRefDevice = SD_MOD()->GetVirtualRefDevice();
- mpFontList = new FontList( pRefDevice, nullptr, false );
+ mpFontList = new FontList(pRefDevice, nullptr);
SvxFontListItem aFontListItem( mpFontList, SID_ATTR_CHAR_FONTLIST );
PutItem( aFontListItem );
}
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index 341a1f83e8bb..4a31b22ba7f4 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -238,8 +238,7 @@ ImplFontListNameInfo* FontList::ImplFindByName(const OUString& rStr) const
return ImplFind( aSearchName, nullptr );
}
-void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
- bool bInsertData )
+void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData)
{
rtl_TextEncoding eSystemEncoding = osl_getThreadTextEncoding();
@@ -260,11 +259,6 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
for (int i = 0; i < n; ++i)
{
FontMetric aFontMetric = pDevice->GetDevFont( i );
-
- // ignore raster-fonts if they are not to be displayed
- if ( !bAll && (aFontMetric.GetType() == TYPE_RASTER) )
- continue;
-
OUString aSearchName(aFontMetric.GetFamilyName());
ImplFontListNameInfo* pData;
sal_uLong nIndex;
@@ -338,7 +332,7 @@ void FontList::ImplInsertFonts( OutputDevice* pDevice, bool bAll,
}
}
-FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, bool bAll )
+FontList::FontList(OutputDevice* pDevice, OutputDevice* pDevice2)
{
// initialise variables
mpDev = pDevice;
@@ -355,7 +349,7 @@ FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, bool bAll )
maBlack = SVT_RESSTR(STR_SVT_STYLE_BLACK);
maBlackItalic = SVT_RESSTR(STR_SVT_STYLE_BLACK_ITALIC);
- ImplInsertFonts( pDevice, bAll, true );
+ ImplInsertFonts(pDevice, true);
// if required compare to the screen fonts
// in order to map the duplicates to Equal
@@ -368,7 +362,7 @@ FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, bool bAll )
if ( pDevice2 &&
(pDevice2->GetOutDevType() != pDevice->GetOutDevType()) )
- ImplInsertFonts( pDevice2, bAll, !bCompareWindow );
+ ImplInsertFonts(pDevice2, !bCompareWindow);
}
FontList::~FontList()
@@ -392,8 +386,7 @@ FontList::~FontList()
FontList* FontList::Clone() const
{
- FontList* pReturn = new FontList(
- mpDev, mpDev2, sal::static_int_cast<int>(GetFontNameCount()) == mpDev->GetDevFontCount());
+ FontList* pReturn = new FontList(mpDev, mpDev2);
return pReturn;
}
@@ -538,14 +531,6 @@ OUString FontList::GetFontMapText( const FontMetric& rInfo ) const
const_cast<FontList*>(this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY);
return maMapPrinterOnly;
}
- // Only Screen-Font?
- else if ( nType == FontListFontNameType::SCREEN
- && rInfo.GetType() == TYPE_RASTER )
- {
- if (maMapScreenOnly.isEmpty())
- const_cast<FontList*>(this)->maMapScreenOnly = SVT_RESSTR(STR_SVT_FONTMAP_SCREENONLY);
- return maMapScreenOnly;
- }
else
{
if (maMapBoth.isEmpty())
diff --git a/vcl/inc/PhysicalFontCollection.hxx b/vcl/inc/PhysicalFontCollection.hxx
index ca499e718885..0ff6868b9853 100644
--- a/vcl/inc/PhysicalFontCollection.hxx
+++ b/vcl/inc/PhysicalFontCollection.hxx
@@ -62,7 +62,7 @@ public:
void SetFallbackHook( ImplGlyphFallbackFontSubstitution* );
// misc utilities
- PhysicalFontCollection* Clone( bool bEmbeddable ) const;
+ PhysicalFontCollection* Clone() const;
ImplDeviceFontList* GetDeviceFontList() const;
ImplDeviceFontSizeList* GetDeviceFontSizeList( const OUString& rFontName ) const;
diff --git a/vcl/inc/PhysicalFontFace.hxx b/vcl/inc/PhysicalFontFace.hxx
index f4b1c1ada339..051ffcb6c288 100644
--- a/vcl/inc/PhysicalFontFace.hxx
+++ b/vcl/inc/PhysicalFontFace.hxx
@@ -78,7 +78,6 @@ public:
int GetHeight() const { return mnHeight; }
int GetWidth() const { return mnWidth; }
virtual sal_IntPtr GetFontId() const = 0;
- bool IsScalable() const { return (mnHeight == 0); }
bool IsBetterMatch( const FontSelectPattern&, FontMatchStatus& ) const;
sal_Int32 CompareWithSize( const PhysicalFontFace& ) const;
diff --git a/vcl/inc/PhysicalFontFamily.hxx b/vcl/inc/PhysicalFontFamily.hxx
index 07d329c711d9..34548785c56d 100644
--- a/vcl/inc/PhysicalFontFamily.hxx
+++ b/vcl/inc/PhysicalFontFamily.hxx
@@ -54,7 +54,6 @@ public:
const OUString& GetFamilyName() const { return maFamilyName; }
const OUString& GetSearchName() const { return maSearchName; }
const OUString& GetAliasNames() const { return maMapNames; }
- bool IsScalable() const { return maFontFaces[0]->IsScalable(); }
int GetMinQuality() const { return mnMinQuality; }
FontTypeFaces GetTypeFaces() const { return mnTypeFaces; }
void GetFontHeights( std::set<int>& rHeights ) const;
@@ -71,8 +70,7 @@ public:
PhysicalFontFace* FindBestFontFace( const FontSelectPattern& rFSD ) const;
void UpdateDevFontList( ImplDeviceFontList& ) const;
- void UpdateCloneFontList( PhysicalFontCollection&,
- bool bEmbeddable ) const;
+ void UpdateCloneFontList(PhysicalFontCollection&) const;
static void CalcType( ImplFontAttrs& rType, FontWeight& rWeight, FontWidth& rWidth,
FontFamily eFamily, const utl::FontNameAttr* pFontAttr );
diff --git a/vcl/inc/fontattributes.hxx b/vcl/inc/fontattributes.hxx
index fcd2fa825f72..9b3cc7f65363 100644
--- a/vcl/inc/fontattributes.hxx
+++ b/vcl/inc/fontattributes.hxx
@@ -63,19 +63,11 @@ public:
int GetQuality() const { return mnQuality; }
const OUString& GetMapNames() const { return maMapNames; }
- bool IsBuiltInFont() const { return mbDevice; }
- bool CanEmbed() const { return mbEmbeddable; }
- bool CanSubset() const { return mbSubsettable; }
void SetQuality( int nQuality ) { mnQuality = nQuality; }
void IncreaseQualityBy( int nQualityAmount ) { mnQuality += nQualityAmount; }
void AddMapName( OUString const& );
- void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; }
- void SetEmbeddableFlag ( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; }
- void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
- void SetOrientationFlag( bool bCanRotate ) { mbOrientation = bCanRotate; }
-
private:
// device independent variables
OUString maFamilyName; // Font Family Name
@@ -91,10 +83,6 @@ private:
// device dependent variables
OUString maMapNames; // List of family name aliases separated with ';'
int mnQuality; // Quality (used when similar fonts compete)
- bool mbOrientation; // true: physical font can be rotated
- bool mbDevice; // true: built in font
- bool mbSubsettable; // true: a subset of the font can be created
- bool mbEmbeddable; // true: the font can be embedded
};
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index 7584dda707b1..654dc0c7429b 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -78,16 +78,6 @@ public:
void DecreaseQualityBy( int nQualityAmount ) { mnQuality -= nQualityAmount; }
void SetMapNames( OUString const & aMapNames ) { maMapNames = aMapNames; }
- bool IsBuiltInFont() const { return mbDevice; }
- bool CanEmbed() const { return mbEmbeddable; }
- bool CanSubset() const { return mbSubsettable; }
- bool CanRotate() const { return mbRotatable; }
-
- void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; }
- void SetEmbeddableFlag( bool bEmbeddable ) { mbEmbeddable = bEmbeddable; }
- void SetSubsettableFlag( bool bSubsettable ) { mbSubsettable = bSubsettable; }
- void SetOrientationFlag( bool bCanRotate ) { mbRotatable = bCanRotate; }
-
bool operator==( const ImplFont& ) const;
private:
@@ -132,11 +122,7 @@ private:
// Device dependent variables
OUString maMapNames;
- bool mbWordLine:1,
- mbEmbeddable:1,
- mbSubsettable:1,
- mbRotatable:1, // is "rotatable" even a word?!? I'll keep it for consistency for now
- mbDevice:1;
+ bool mbWordLine:1;
// TODO: metric data, should be migrated to ImplFontMetric
short mnOrientation;
diff --git a/vcl/inc/impfontmetric.hxx b/vcl/inc/impfontmetric.hxx
index c0d7c60a4d5b..6267a30fddfd 100644
--- a/vcl/inc/impfontmetric.hxx
+++ b/vcl/inc/impfontmetric.hxx
@@ -44,13 +44,9 @@ public:
void SetSlant( long nSlant ) { mnSlant = nSlant; }
void SetBulletOffset( long nOffset ) { mnBulletOffset = nOffset; }
- bool IsScalable() const { return mbScalableFont; }
bool IsFullstopCentered() const { return mbFullstopCentered; }
- bool IsBuiltInFont() const { return mbDevice; }
- void SetScalableFlag( bool bScalable ) { mbScalableFont = bScalable; }
void SetFullstopCenteredFlag( bool bCentered ) { mbFullstopCentered = bCentered; }
- void SetBuiltInFontFlag( bool bIsBuiltInFont ) { mbDevice = bIsBuiltInFont; }
bool operator==( const ImplFontMetric& ) const;
@@ -65,9 +61,7 @@ private:
long mnSlant; // Slant
long mnBulletOffset; // Offset for non-printing character
- bool mbScalableFont;
bool mbFullstopCentered;
- bool mbDevice;
};
diff --git a/vcl/inc/impfontmetricdata.hxx b/vcl/inc/impfontmetricdata.hxx
index 8122bbd30ca8..31a0557f341e 100644
--- a/vcl/inc/impfontmetricdata.hxx
+++ b/vcl/inc/impfontmetricdata.hxx
@@ -58,15 +58,9 @@ public:
void SetMinKashida( long nMinKashida ) { mnMinKashida=nMinKashida; }
// font attributes queried from the font instance
- bool IsScalable() { return mbScalableFont; }
- bool IsTrueTypeFont() { return mbTrueTypeFont; }
- bool IsKernable() { return mbKernableFont; }
bool IsFullstopCentered() { return mbFullstopCentered; }
long GetBulletOffset() { return mnBulletOffset; }
- void SetScalableFlag(bool bScalable) { mbScalableFont = bScalable; }
- void SetTrueTypeFlag(bool bTrueTypeFont) { mbTrueTypeFont = bTrueTypeFont; }
- void SetKernableFlag(bool bKernable) { mbKernableFont = bKernable; }
void SetFullstopCenteredFlag(bool bFullstopCentered) { mbFullstopCentered = bFullstopCentered; }
// font metrics that are usually derived from the measurements
@@ -117,9 +111,6 @@ private:
long mnMinKashida; // Minimal width of kashida (Arabic)
// font attributes queried from the font instance
- bool mbScalableFont;
- bool mbTrueTypeFont;
- bool mbKernableFont;
bool mbFullstopCentered;
long mnBulletOffset; // Offset to position non-print character
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index d496ebe418d3..f31a6f4bfb62 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -28,10 +28,6 @@ public:
void testItalic();
void testAlignment();
void testQuality();
- void testBuiltInFontFlag();
- void testEmbeddableFontFlag();
- void testSubsettableFontFlag();
- void testOrientationFlag();
void testSymbolFlagAndCharSet();
CPPUNIT_TEST_SUITE(VclFontTest);
@@ -42,10 +38,6 @@ public:
CPPUNIT_TEST(testItalic);
CPPUNIT_TEST(testAlignment);
CPPUNIT_TEST(testQuality);
- CPPUNIT_TEST(testBuiltInFontFlag);
- CPPUNIT_TEST(testEmbeddableFontFlag);
- CPPUNIT_TEST(testSubsettableFontFlag);
- CPPUNIT_TEST(testOrientationFlag);
CPPUNIT_TEST(testSymbolFlagAndCharSet);
CPPUNIT_TEST_SUITE_END();
};
@@ -131,48 +123,6 @@ void VclFontTest::testQuality()
CPPUNIT_ASSERT_EQUAL( (int)50, aFont.GetQuality() );
}
-void VclFontTest::testBuiltInFontFlag()
-{
- vcl::Font aFont;
-
- CPPUNIT_ASSERT_EQUAL( false, aFont.IsBuiltInFont() );
-
- aFont.SetBuiltInFontFlag( true );
- CPPUNIT_ASSERT_EQUAL( true, aFont.IsBuiltInFont() );
-}
-
-void VclFontTest::testEmbeddableFontFlag()
-{
- vcl::Font aFont;
-
- CPPUNIT_ASSERT_EQUAL( false, aFont.CanEmbed() );
-
- aFont.SetEmbeddableFlag( true );
- CPPUNIT_ASSERT_EQUAL( true, aFont.CanEmbed() );
-}
-
-
-void VclFontTest::testSubsettableFontFlag()
-{
- vcl::Font aFont;
-
- CPPUNIT_ASSERT_EQUAL( false, aFont.CanSubset() );
-
- aFont.SetSubsettableFlag( true );
- CPPUNIT_ASSERT_EQUAL( true, aFont.CanSubset() );
-}
-
-
-void VclFontTest::testOrientationFlag()
-{
- vcl::Font aFont;
-
- CPPUNIT_ASSERT_EQUAL( false, aFont.CanRotate() );
-
- aFont.SetOrientationFlag( true );
- CPPUNIT_ASSERT_EQUAL( true, aFont.CanRotate() );
-}
-
void VclFontTest::testSymbolFlagAndCharSet()
{
diff --git a/vcl/qa/cppunit/fontmetric.cxx b/vcl/qa/cppunit/fontmetric.cxx
index 4f82adc61698..f28aa0d5bff7 100644
--- a/vcl/qa/cppunit/fontmetric.cxx
+++ b/vcl/qa/cppunit/fontmetric.cxx
@@ -23,18 +23,14 @@ class VclFontMetricTest : public test::BootstrapFixture
public:
VclFontMetricTest() : BootstrapFixture(true, false) {}
- void testScalableFlag();
void testFullstopCenteredFlag();
- void testBuiltInFontFlag();
void testSpacings();
void testSlant();
void testBulletOffset();
void testEqualityOperator();
CPPUNIT_TEST_SUITE(VclFontMetricTest);
- CPPUNIT_TEST(testScalableFlag);
CPPUNIT_TEST(testFullstopCenteredFlag);
- CPPUNIT_TEST(testBuiltInFontFlag);
CPPUNIT_TEST(testSpacings);
CPPUNIT_TEST(testSlant);
CPPUNIT_TEST(testBulletOffset);
@@ -42,18 +38,6 @@ public:
CPPUNIT_TEST_SUITE_END();
};
-void VclFontMetricTest::testScalableFlag()
-{
- // default constructor should set scalable flag to false
- FontMetric aFontMetric;
-
- CPPUNIT_ASSERT_MESSAGE( "Scalable flag should be false after default constructor called", !aFontMetric.IsScalable() );
-
- aFontMetric.SetScalableFlag(true);
-
- CPPUNIT_ASSERT_MESSAGE( "Scalable flag should be true", aFontMetric.IsScalable() );
-}
-
void VclFontMetricTest::testFullstopCenteredFlag()
{
// default constructor should set scalable flag to false
@@ -66,18 +50,6 @@ void VclFontMetricTest::testFullstopCenteredFlag()
CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag should be true", aFontMetric.IsFullstopCentered() );
}
-void VclFontMetricTest::testBuiltInFontFlag()
-{
- // default constructor should set scalable flag to false
- FontMetric aFontMetric;
-
- CPPUNIT_ASSERT_MESSAGE( "Built-in font flag should be false after default constructor called", !aFontMetric.IsBuiltInFont() );
-
- aFontMetric.SetBuiltInFontFlag(true);
-
- CPPUNIT_ASSERT_MESSAGE( "Built-in font flag should be true", aFontMetric.IsBuiltInFont() );
-}
-
void VclFontMetricTest::testSpacings()
{
// default constructor should set scalable flag to false
@@ -133,21 +105,11 @@ void VclFontMetricTest::testEqualityOperator()
// default constructor should set scalable flag to false
FontMetric aLhs, aRhs;
- aLhs.SetScalableFlag(true);
- aRhs.SetScalableFlag(true);
- CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs == aRhs failed", aLhs == aRhs );
- CPPUNIT_ASSERT_MESSAGE( "Scalable flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) );
-
aLhs.SetFullstopCenteredFlag(true);
aRhs.SetFullstopCenteredFlag(true);
CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs == aRhs failed", aLhs == aRhs );
CPPUNIT_ASSERT_MESSAGE( "Fullstop centered flag set same, aLhs != aRhs succeeded", !(aLhs != aRhs) );
- aLhs.SetBuiltInFontFlag(true);
- aRhs.SetBuiltInFontFlag(true);
- CPPUNIT_ASSERT_MESSAGE( "Builtin font flag set same, aLHS == aRhs failed", aLhs == aRhs );
- CPPUNIT_ASSERT_MESSAGE( "Builtin font flag set same, aLHS != aRhs succeeded", !(aLhs != aRhs) );
-
aLhs.SetExternalLeading(10);
aRhs.SetExternalLeading(10);
CPPUNIT_ASSERT_MESSAGE( "External leading set same, aLHS == aRhs failed", aLhs == aRhs );
diff --git a/vcl/quartz/ctfonts.cxx b/vcl/quartz/ctfonts.cxx
index e628be42d247..acc8add0b9f3 100644
--- a/vcl/quartz/ctfonts.cxx
+++ b/vcl/quartz/ctfonts.cxx
@@ -138,11 +138,6 @@ void CoreTextStyle::GetFontMetric( ImplFontMetricDataRef& rxFontMetric ) const
// it also makes the calculation of the stretch factor simple
rxFontMetric->SetWidth( lrint( CTFontGetSize( aCTFontRef ) * mfFontStretch) );
- // all CoreText fonts are scalable
- rxFontMetric->SetScalableFlag( true );
- rxFontMetric->SetTrueTypeFlag( true ); // Not sure, but this field is used only for Windows so far
- rxFontMetric->SetKernableFlag( true );
-
UniChar nKashidaCh = 0x0640;
CGGlyph nKashidaGid = 0;
if (CTFontGetGlyphsForCharacters(aCTFontRef, &nKashidaCh, &nKashidaGid, 1))
@@ -310,8 +305,6 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
{
// all CoreText fonts are device fonts that can rotate just fine
FontAttributes rDFA;
- rDFA.SetOrientationFlag( true );
- rDFA.SetBuiltInFontFlag( true );
rDFA.SetQuality( 0 );
// reset the font attributes
@@ -322,10 +315,6 @@ FontAttributes DevFontFromCTFontDescriptor( CTFontDescriptorRef pFD, bool* bFont
rDFA.SetItalic( ITALIC_NONE );
rDFA.SetSymbolFlag( false );
- // all scalable fonts on this platform are subsettable
- rDFA.SetEmbeddableFlag( false );
- rDFA.SetSubsettableFlag( true );
-
// get font name
#ifdef MACOSX
const OUString aUILang = Application::GetSettings().GetUILanguageTag().getLanguage();
diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx
index 0333bbf0f6c2..e46ad771ace8 100644
--- a/vcl/quartz/salgdi.cxx
+++ b/vcl/quartz/salgdi.cxx
@@ -777,16 +777,6 @@ void AquaSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFontData, bool bV
rGlyphWidths.clear();
rUnicodeEnc.clear();
- if( !pFontData->CanSubset() )
- {
- if( pFontData->CanEmbed() )
- {
- // get individual character widths
- OSL_FAIL("not implemented for non-subsettable fonts!\n");
- }
- return;
- }
-
std::vector<unsigned char> aBuffer;
if( !GetRawFontData( pFontData, aBuffer, nullptr ) )
return;
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 3d7bf9a0b375..1669ae603b35 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 2e80762581bd..1d3bc028dc73 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -528,7 +528,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 c39ff3fc02a3..2bd5ca749f07 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
{
diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
index 54006e1aac01..4f41cb7d1650 100644
--- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
+++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx
@@ -365,8 +365,6 @@ FreetypeFontFace::FreetypeFontFace( FreetypeFontInfo* pFI, const FontAttributes&
: PhysicalFontFace( rDFA ),
mpFreetypeFontInfo( pFI )
{
- SetBuiltInFontFlag( false );
- SetOrientationFlag( true );
}
LogicalFontInstance* FreetypeFontFace::CreateFontInstance( FontSelectPattern& rFSD ) const
@@ -573,10 +571,6 @@ void FreetypeFont::GetFontMetric(ImplFontMetricDataRef& rxTo) const
{
rxTo->FontAttributes::operator =(mpFontInfo->GetFontAttributes());
- rxTo->SetScalableFlag( true ); // FIXME: Shouldn't this check FT_IS_SCALABLE( maFaceFT )?
- rxTo->SetTrueTypeFlag( FT_IS_SFNT( maFaceFT ) != 0 );
- rxTo->SetBuiltInFontFlag( true );
- rxTo->SetKernableFlag( FT_HAS_KERNING( maFaceFT ) != 0 );
rxTo->SetOrientation( GetFontSelData().mnOrientation );
//Always consider [star]symbol as symbol fonts
diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx
index 7a25889ee191..2c51d04defbc 100644
--- a/vcl/unx/generic/print/genpspgraphics.cxx
+++ b/vcl/unx/generic/print/genpspgraphics.cxx
@@ -892,12 +892,7 @@ FontAttributes GenPspGraphics::Info2FontAttributes( const psp::FastPrintFontInfo
aDFA.SetWidthType( rInfo.m_eWidth );
aDFA.SetPitch( rInfo.m_ePitch );
aDFA.SetSymbolFlag( (rInfo.m_aEncoding == RTL_TEXTENCODING_SYMBOL) );
- aDFA.SetSubsettableFlag( rInfo.m_bSubsettable );
- aDFA.SetEmbeddableFlag(false);
aDFA.SetQuality(512);
- aDFA.SetBuiltInFontFlag(false);
-
- aDFA.SetOrientationFlag( true );
// add font family name aliases
::std::list< OUString >::const_iterator it = rInfo.m_aAliases.begin();
diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx
index 1773a6d6e778..4d3d5d561a34 100644
--- a/vcl/win/gdi/salfont.cxx
+++ b/vcl/win/gdi/salfont.cxx
@@ -515,7 +515,7 @@ inline BYTE ImplPitchToWin( FontPitch ePitch )
}
static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont,
- const NEWTEXTMETRICW& rMetric, DWORD nFontType )
+ const NEWTEXTMETRICW& rMetric)
{
FontAttributes aDFA;
@@ -542,46 +542,13 @@ static FontAttributes WinFont2DevFontAttributes( const ENUMLOGFONTEXW& rEnumFont
if( p < pEnd )
aDFA.SetStyleName(OUString(reinterpret_cast<const sal_Unicode*>(pStyleName)));
- // get device specific font attributes
- aDFA.SetOrientationFlag( ((nFontType & RASTER_FONTTYPE) == 0) );
- aDFA.SetBuiltInFontFlag( ((rMetric.tmPitchAndFamily & TMPF_DEVICE) != 0) );
-
- aDFA.SetEmbeddableFlag( false );
- aDFA.SetSubsettableFlag( false );
- if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE))
- || 0 != (rMetric.tmPitchAndFamily & TMPF_TRUETYPE))
- aDFA.SetSubsettableFlag( true );
- else if( 0 != (rMetric.ntmFlags & NTM_TYPE1) ) // TODO: implement subsetting for type1 too
- aDFA.SetEmbeddableFlag( true );
-
// heuristics for font quality
- // - standard-type1 > opentypeTT > truetype > non-standard-type1 > raster
- // - subsetting > embedding > none
+ // - opentypeTT > truetype
aDFA.SetQuality( 0 );
if( rMetric.tmPitchAndFamily & TMPF_TRUETYPE )
aDFA.IncreaseQualityBy( 50 );
if( 0 != (rMetric.ntmFlags & (NTM_TT_OPENTYPE | NTM_PS_OPENTYPE)) )
aDFA.IncreaseQualityBy( 10 );
- if( aDFA.CanSubset() )
- aDFA.IncreaseQualityBy( 200 );
- else if( aDFA.CanEmbed() )
- aDFA.IncreaseQualityBy( 100 );
-
- // #i38665# prefer Type1 versions of the standard postscript fonts
- if( aDFA.CanEmbed() )
- {
- if( aDFA.GetFamilyName() == "AvantGarde"
- || aDFA.GetFamilyName() == "Bookman"
- || aDFA.GetFamilyName() == "Courier"
- || aDFA.GetFamilyName() == "Helvetica"
- || aDFA.GetFamilyName() == "NewCenturySchlbk"
- || aDFA.GetFamilyName() == "Palatino"
- || aDFA.GetFamilyName() == "Symbol"
- || aDFA.GetFamilyName() == "Times"
- || aDFA.GetFamilyName() == "ZapfChancery"
- || aDFA.GetFamilyName() == "ZapfDingbats" )
- aDFA.IncreaseQualityBy( 500 );
- }
// TODO: add alias names
return aDFA;
@@ -597,7 +564,7 @@ static WinFontFace* ImplLogMetricToDevFontDataW( const ENUMLOGFONTEXW* pLogFont,
nHeight = pMetric->tmHeight - pMetric->tmInternalLeading;
WinFontFace* pData = new WinFontFace(
- WinFont2DevFontAttributes(*pLogFont, *pMetric, nFontType),
+ WinFont2DevFontAttributes(*pLogFont, *pMetric),
nHeight,
pLogFont->elfLogFont.lfCharSet,
pMetric->tmPitchAndFamily );
@@ -1132,25 +1099,6 @@ void WinSalGraphics::GetFontMetric( ImplFontMetricDataRef& rxFontMetric, int nFa
rxFontMetric->SetItalic(aWinMetric.tmItalic ? ITALIC_NORMAL : ITALIC_NONE);
rxFontMetric->SetSlant( 0 );
- // device dependent font attributes
- rxFontMetric->SetBuiltInFontFlag( (aWinMetric.tmPitchAndFamily & TMPF_DEVICE) != 0 );
- rxFontMetric->SetScalableFlag( (aWinMetric.tmPitchAndFamily & (TMPF_VECTOR|TMPF_TRUETYPE)) != 0 );
- rxFontMetric->SetTrueTypeFlag( (aWinMetric.tmPitchAndFamily & TMPF_TRUETYPE) != 0 );
- if( rxFontMetric->IsScalable() )
- {
- // check if there are kern pairs
- // TODO: does this work with GPOS kerning?
- DWORD nKernPairs = ::GetKerningPairsA( getHDC(), 0, nullptr );
- rxFontMetric->SetKernableFlag( (nKernPairs > 0) );
- }
- else
- {
- // bitmap fonts cannot be rotated directly
- rxFontMetric->SetOrientation( 0 );
- // bitmap fonts have no kerning
- rxFontMetric->SetKernableFlag( false );
- }
-
// transformation dependent font metrics
rxFontMetric->SetWidth( static_cast<int>( mfFontScale[nFallbackLevel] * aWinMetric.tmAveCharWidth ) );
@@ -1378,14 +1326,11 @@ static bool ImplGetFontAttrFromFile( const OUString& rFontFileURL,
// get FontAttributes from a *fot file
// TODO: use GetTTGlobalFontInfo() to access the font directly
rDFA.SetQuality( 1000 );
- rDFA.SetBuiltInFontFlag( true );
rDFA.SetFamilyType(FAMILY_DONTKNOW);
rDFA.SetWidthType(WIDTH_DONTKNOW);
rDFA.SetWeight(WEIGHT_DONTKNOW);
rDFA.SetItalic(ITALIC_DONTKNOW);
rDFA.SetPitch(PITCH_DONTKNOW);
- rDFA.SetSubsettableFlag( true );
- rDFA.SetEmbeddableFlag( false );
// Create temporary file name
char aFileName[] = "soAAT.fot";
@@ -1471,7 +1416,6 @@ bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
FontAttributes aDFA;
aDFA.SetFamilyName(rFontName);
aDFA.SetQuality( 1000 );
- aDFA.SetBuiltInFontFlag( true );
// Retrieve font name from font resource
if( aDFA.GetFamilyName().isEmpty() )
@@ -1493,8 +1437,6 @@ bool WinSalGraphics::AddTempDevFont( PhysicalFontCollection* pFontCollection,
aDFA.SetWeight(WEIGHT_DONTKNOW);
aDFA.SetItalic(ITALIC_DONTKNOW);
aDFA.SetPitch(PITCH_DONTKNOW);
- aDFA.SetSubsettableFlag( true );
- aDFA.SetEmbeddableFlag( false );
/*
// TODO: improve FontAttributes using the "font resource file"
@@ -2065,29 +2007,9 @@ void WinSalGraphics::FreeEmbedFontData( const void* pData, long /*nLen*/ )
delete[] static_cast<char const *>(pData);
}
-const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector( const PhysicalFontFace* pFont, const Ucs2OStrMap** pNonEncoded, std::set<sal_Unicode> const**)
+const Ucs2SIntMap* WinSalGraphics::GetFontEncodingVector(const PhysicalFontFace*, const Ucs2OStrMap**, std::set<sal_Unicode> const**)
{
- // TODO: even for builtin fonts we get here... why?
- if( !pFont->CanEmbed() )
- return nullptr;
-
- // fill the encoding vector
- // currently no nonencoded vector
- if( pNonEncoded )
- *pNonEncoded = nullptr;
-
- const WinFontFace* pWinFontData = static_cast<const WinFontFace*>(pFont);
- const Ucs2SIntMap* pEncoding = pWinFontData->GetEncodingVector();
- if( pEncoding == nullptr )
- {
- Ucs2SIntMap* pNewEncoding = new Ucs2SIntMap;
- for( sal_Unicode i = 32; i < 256; ++i )
- (*pNewEncoding)[i] = i;
- pWinFontData->SetEncodingVector( pNewEncoding );
- pEncoding = pNewEncoding;
- }
-
- return pEncoding;
+ return nullptr;
}
void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
@@ -2106,78 +2028,59 @@ void WinSalGraphics::GetGlyphWidths( const PhysicalFontFace* pFont,
HFONT hOldFont = nullptr;
ImplDoSetFont( &aIFSD, fScale, hOldFont );
- if( pFont->CanSubset() )
- {
- // get raw font file data
- const RawFontData xRawFontData( getHDC() );
- if( !xRawFontData.get() )
- return;
-
- // open font file
- sal_uInt32 nFaceNum = 0;
- if( !*xRawFontData.get() ) // TTC candidate
- nFaceNum = ~0U; // indicate "TTC font extracts only"
-
- ScopedTrueTypeFont aSftTTF;
- int nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum );
- if( nRC != SF_OK )
- return;
-
- int nGlyphs = GetTTGlyphCount( aSftTTF.get() );
- if( nGlyphs > 0 )
- {
- rWidths.resize(nGlyphs);
- std::vector<sal_uInt16> aGlyphIds(nGlyphs);
- for( int i = 0; i < nGlyphs; i++ )
- aGlyphIds[i] = sal_uInt16(i);
- TTSimpleGlyphMetrics* pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(),
- &aGlyphIds[0],
- nGlyphs,
- bVertical );
- if( pMetrics )
- {
- for( int i = 0; i< nGlyphs; i++ )
- rWidths[i] = pMetrics[i].adv;
- free( pMetrics );
- rUnicodeEnc.clear();
- }
- const WinFontFace* pWinFont = static_cast<const WinFontFace*>(pFont);
- FontCharMapRef xFCMap = pWinFont->GetFontCharMap();
- SAL_WARN_IF( !xFCMap.Is() || !xFCMap->GetCharCount(), "vcl", "no map" );
+ // get raw font file data
+ const RawFontData xRawFontData( getHDC() );
+ if( !xRawFontData.get() )
+ return;
- int nCharCount = xFCMap->GetCharCount();
- sal_uInt32 nChar = xFCMap->GetFirstChar();
- for( int i = 0; i < nCharCount; i++ )
- {
- if( nChar < 0x00010000 )
- {
- sal_uInt16 nGlyph = ::MapChar( aSftTTF.get(),
- static_cast<sal_Ucs>(nChar),
- bVertical );
- if( nGlyph )
- rUnicodeEnc[ static_cast<sal_Unicode>(nChar) ] = nGlyph;
- }
- nChar = xFCMap->GetNextChar( nChar );
- }
+ // open font file
+ sal_uInt32 nFaceNum = 0;
+ if( !*xRawFontData.get() ) // TTC candidate
+ nFaceNum = ~0U; // indicate "TTC font extracts only"
- xFCMap = nullptr;
- }
- }
- else if( pFont->CanEmbed() )
+ ScopedTrueTypeFont aSftTTF;
+ int nRC = aSftTTF.open( xRawFontData.get(), xRawFontData.size(), nFaceNum );
+ if( nRC != SF_OK )
+ return;
+
+ int nGlyphs = GetTTGlyphCount( aSftTTF.get() );
+ if( nGlyphs > 0 )
{
- // get individual character widths
- rWidths.clear();
- rUnicodeEnc.clear();
- rWidths.reserve( 224 );
- for( sal_Unicode i = 32; i < 256; ++i )
+ rWidths.resize(nGlyphs);
+ std::vector<sal_uInt16> aGlyphIds(nGlyphs);
+ for( int i = 0; i < nGlyphs; i++ )
+ aGlyphIds[i] = sal_uInt16(i);
+ TTSimpleGlyphMetrics* pMetrics = ::GetTTSimpleGlyphMetrics( aSftTTF.get(),
+ &aGlyphIds[0],
+ nGlyphs,
+ bVertical );
+ if( pMetrics )
{
- int nCharWidth = 0;
- if( ::GetCharWidth32W( getHDC(), i, i, &nCharWidth ) )
+ for( int i = 0; i< nGlyphs; i++ )
+ rWidths[i] = pMetrics[i].adv;
+ free( pMetrics );
+ rUnicodeEnc.clear();
+ }
+ const WinFontFace* pWinFont = static_cast<const WinFontFace*>(pFont);
+ FontCharMapRef xFCMap = pWinFont->GetFontCharMap();
+ SAL_WARN_IF( !xFCMap.Is() || !xFCMap->GetCharCount(), "vcl", "no map" );
+
+ int nCharCount = xFCMap->GetCharCount();
+ sal_uInt32 nChar = xFCMap->GetFirstChar();
+ for( int i = 0; i < nCharCount; i++ )
+ {
+ if( nChar < 0x00010000 )
{
- rUnicodeEnc[ i ] = rWidths.size();
- rWidths.push_back( nCharWidth );
+ sal_uInt16 nGlyph = ::MapChar( aSftTTF.get(),
+ static_cast<sal_Ucs>(nChar),
+ bVertical );
+ if( nGlyph )
+ rUnicodeEnc[ static_cast<sal_Unicode>(nChar) ] = nGlyph;
}
+ nChar = xFCMap->GetNextChar( nChar );
}
+
+ xFCMap = nullptr;
}
}