[Libreoffice-commits] core.git: include/vcl vcl/inc vcl/qa vcl/source

Chris Sherlock chris.sherlock79 at gmail.com
Wed Jan 20 22:23:18 PST 2016


 include/vcl/font.hxx     |    2 ++
 vcl/inc/impfont.hxx      |   11 ++++++-----
 vcl/qa/cppunit/font.cxx  |   13 +++++++++++++
 vcl/source/font/font.cxx |    4 ++++
 4 files changed, 25 insertions(+), 5 deletions(-)

New commits:
commit a5372932f787534d15d4e36ee8c297f3c6ac0888
Author: Chris Sherlock <chris.sherlock79 at gmail.com>
Date:   Thu Jan 21 15:13:22 2016 +1100

    vcl: add subsettable flag property functions to Font class
    
    Added getter and setter for subsettable flag property to the
    Font class.
    
    See commit description in 8bfccd3a71d911b6d ("vcl: Create accessor
    and mutator for font scaling in FontMetric") for reasoning behind
    patch.
    
    Unit test added to vcl/qa/cppunit/font.cxx to test this flag.
    
    Change-Id: I2a66f1c4876698e1ffeaf260b2b43d5308b71191
    Reviewed-on: https://gerrit.libreoffice.org/21651
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Chris Sherlock <chris.sherlock79 at gmail.com>

diff --git a/include/vcl/font.hxx b/include/vcl/font.hxx
index 8cb34b6..498c6a5 100644
--- a/include/vcl/font.hxx
+++ b/include/vcl/font.hxx
@@ -87,6 +87,7 @@ public:
 
     bool                IsBuiltInFont() const;
     bool                CanEmbed() const;
+    bool                CanSubset() const;
 
     void                SetQuality(int);
     void                IncreaseQualityBy(int);
@@ -94,6 +95,7 @@ public:
 
     void                SetBuiltInFontFlag(bool);
     void                SetEmbeddableFlag(bool);
+    void                SetSubsettableFlag(bool);
 
     // setting the color on the font is obsolete, the only remaining
     // valid use is for keeping backward compatibility with old MetaFiles
diff --git a/vcl/inc/impfont.hxx b/vcl/inc/impfont.hxx
index cc87b2e..e522c28 100644
--- a/vcl/inc/impfont.hxx
+++ b/vcl/inc/impfont.hxx
@@ -37,8 +37,8 @@ public:
 
     // device independent font functions
     const OUString&     GetFamilyName() const                           { return maFamilyName; }
-    FontFamily          GetFamilyType()                                     { if(meFamily==FAMILY_DONTKNOW)  AskConfig(); return meFamily; }
-    FontFamily          GetFamilyTypeNoAsk() const                          { return meFamily; }
+    FontFamily          GetFamilyType()                                 { if(meFamily==FAMILY_DONTKNOW)  AskConfig(); return meFamily; }
+    FontFamily          GetFamilyTypeNoAsk() const                      { return meFamily; }
     const OUString&     GetStyleName() const                            { return maStyleName; }
 
     FontWeight          GetWeight()                                     { if(meWeight==WEIGHT_DONTKNOW)  AskConfig(); return meWeight; }
@@ -75,7 +75,7 @@ public:
 
     bool                IsBuiltInFont() const                           { return mbDevice; }
     bool                CanEmbed() const                                { return mbEmbeddable; }
-    /* Missing function: bool CanSubSet() const; */
+    bool                CanSubset() const                               { return mbSubsettable; }
     /* Missing function: bool CanRotate() const; */
     /* Missing function: bool HasMapNames() const; */
 
@@ -84,7 +84,7 @@ public:
 
     void                SetBuiltInFontFlag( bool bIsBuiltInFont )       { mbDevice = bIsBuiltInFont; }
     void                SetEmbeddableFlag( bool bEmbeddable )           { mbEmbeddable = bEmbeddable; }
-    /* Missing function: void SetSettableFlag( bool ); */
+    void                SetSubsettableFlag( bool bSubsettable )         { mbSubsettable = bSubsettable; }
     /* missing function: void SetOrientationFlag( bool ); */
 
     bool                operator==( const ImplFont& ) const;
@@ -123,7 +123,8 @@ private:
                         mbVertical:1,
                         mbTransparent:1,    // compatibility, now on output device
                         mbDevice:1,
-                        mbEmbeddable:1;
+                        mbEmbeddable:1,
+                        mbSubsettable:1;
     int                 mnQuality;
 
     friend SvStream&    ReadImplFont( SvStream& rIStm, ImplFont& );
diff --git a/vcl/qa/cppunit/font.cxx b/vcl/qa/cppunit/font.cxx
index a57395c0..656d089 100644
--- a/vcl/qa/cppunit/font.cxx
+++ b/vcl/qa/cppunit/font.cxx
@@ -29,6 +29,7 @@ public:
     void testQuality();
     void testBuiltInFontFlag();
     void testEmbeddableFontFlag();
+    void testSubsettableFontFlag();
     void testSymbolFlagAndCharSet();
 
     CPPUNIT_TEST_SUITE(VclFontTest);
@@ -40,6 +41,7 @@ public:
     CPPUNIT_TEST(testQuality);
     CPPUNIT_TEST(testBuiltInFontFlag);
     CPPUNIT_TEST(testEmbeddableFontFlag);
+    CPPUNIT_TEST(testSubsettableFontFlag);
     CPPUNIT_TEST(testSymbolFlagAndCharSet);
     CPPUNIT_TEST_SUITE_END();
 };
@@ -133,6 +135,17 @@ void VclFontTest::testEmbeddableFontFlag()
     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::testSymbolFlagAndCharSet()
 {
     // default constructor should set scalable flag to false
diff --git a/vcl/source/font/font.cxx b/vcl/source/font/font.cxx
index aa85d05..62f35bd 100644
--- a/vcl/source/font/font.cxx
+++ b/vcl/source/font/font.cxx
@@ -817,6 +817,8 @@ 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::IsOutline() const { return mpImplFont->mbOutline; }
 bool Font::IsShadow() const { return mpImplFont->mbShadow; }
 FontRelief Font::GetRelief() const { return mpImplFont->meRelief; }
@@ -858,6 +860,7 @@ ImplFont::ImplFont() :
     mbTransparent( true ),
     mbDevice( false ),
     mbEmbeddable( false ),
+    mbSubsettable( false ),
     mnQuality( 0 )
 {}
 
@@ -893,6 +896,7 @@ ImplFont::ImplFont( const ImplFont& rImplFont ) :
     mbTransparent( rImplFont.mbTransparent ),
     mbDevice( rImplFont.mbDevice ),
     mbEmbeddable( false ),
+    mbSubsettable( false ),
     mnQuality( rImplFont.mnQuality )
 {}
 


More information about the Libreoffice-commits mailing list