diff options
33 files changed, 146 insertions, 694 deletions
diff --git a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx index 9ff91385bc97..d68ea08bb23b 100644 --- a/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx +++ b/chart2/source/controller/drawinglayer/ViewElementListProvider.cxx @@ -185,8 +185,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 6726317d95ba..ba060291e355 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -277,7 +277,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 b3b6bd475fa8..8ef22287baa0 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 974af100fa7c..fdbd04baa294 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -237,8 +237,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(); @@ -253,11 +252,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; @@ -331,7 +325,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; @@ -348,7 +342,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 @@ -361,7 +355,7 @@ FontList::FontList( OutputDevice* pDevice, OutputDevice* pDevice2, bool bAll ) if ( pDevice2 && (pDevice2->GetOutDevType() != pDevice->GetOutDevType()) ) - ImplInsertFonts( pDevice2, bAll, !bCompareWindow ); + ImplInsertFonts(pDevice2, !bCompareWindow); } FontList::~FontList() @@ -385,8 +379,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; } @@ -531,14 +524,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 d5f29b5c073d..7677a0403d40 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)) @@ -297,8 +292,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 @@ -309,10 +302,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 b81bb02b9e3c..ed90f38d114a 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -2245,11 +2245,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; } @@ -2950,63 +2946,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 )); - - 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 ); + 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 ); @@ -8722,139 +8689,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 - { - nFontID = m_nNextFID++; - m_aEmbeddedFonts[ pCurrentFont ] = EmbedFont(); - m_aEmbeddedFonts[ pCurrentFont ].m_nNormalFontID = nFontID; - } - 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; - - 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 ) + 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) ) { - 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; - } - } + rSubset.m_aSubsets.push_back( FontEmit( m_nNextFID++ ) ); } - pMappedGlyphs[ i ] = (sal_Int8)cChar; - pMappedFontObjects[ i ] = nCurFontID; - pGlyphWidths[ i ] = m_aFontCache.getGlyphWidth( pCurrentFont, - (pEncoding ? *pCurUnicode : cChar) | GF_ISCHAR, - false, - pGraphics ); - } + // 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 ); } } 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 45e8a7a5c91b..5763c8ec5c14 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 ) ); @@ -560,7 +554,7 @@ void OutputDevice::ImplRefreshFontData( const bool bNewFontLists ) { if( mpPDFWriter ) { - mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone( true ); + mpFontCollection = pSVData->maGDIData.mpScreenFontList->Clone(); mpFontCache = new ImplFontCache(); } else @@ -1104,9 +1098,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 e08fcd2b1a82..beeb364d071b 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -454,22 +454,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 4320892aa32a..d9fa789cd865 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 a3db6111bf84..c1f1425fafcc 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 1c2cfe4289da..6f5743f25a4e 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 ); @@ -1129,25 +1096,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 ) ); @@ -1334,14 +1282,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"; @@ -1427,7 +1372,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() ) @@ -1449,8 +1393,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" @@ -2021,29 +1963,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, @@ -2062,78 +1984,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; } } |