vcl: remove OutputDevice's GetDevFontSizeCount() and GetDevFontSize()

The OutputDevice::GetDevFontSize() function is only used for
non-scalable (bitmap) fonts. We have stopped supporting bitmap fonts
since LO 5.3, see tdf#103514: Support for bitmap-only fonts on Windows
has been removed (Khaled Hosny)

I found the following when removing PhysicalFontFace::SetBitmapSize():

 1. as mnHeight and mnWidth and not set by anyone, I realized I could
    remove them, which meant removing GetHeight() and GetWidth()

 2. PhysicalFontFamily::GetFontHeights() populates heights from the
    collection of font faces into a sorted vector of font heights taken
    from PhysicalFontFace. As this no longer exists this function
    serves no purpose, it has been removed.

 3. PhysicalFontFamily::GetDeviceFontSizeList() calls upon
    PhysicalFontFace::GetFontHeights(). This function takes this sorted
    list of font heights, and then populates and returns a new list of
    sizes (or rather, heights). As the heights aren't available any
    more, this function is also unneeded, so it has been removed.

 4. OutputDevice::GetDevFontSizeCount() calls upon
    PhysicalFontFamily::GetDeviceFontSizeList(). This function has the
    side effect of initializing the list of fonts.

 5. When I checked what calls on GetDevFontSizeCount(), there is only
    one caller - FontList::GetSizeAry() in svtools. The function returns
    a standard font size list if the family name is empty, or there are
    no font sizes (via OutputDevice::GetDevFontSizeCount()). As this
    will *always* be empty (see chain above) then this function just
    needs to always return a standard font size list.

    Thus OutputDevice::GetDevFontSizeCount() and GetFontSizeList() are
    no longer called upon by anything, so they can be removed.

 6. svtool's FontList::GetSizeAry() no longer uses the FontMetric
    parameter, so this has been removed from the function signature, and
    cleanup done of the function that calls upon it in svtools,
    framework, editeng, and desktop. A number of variables that were no
    longer used due to this change were also removed.

 7. This change removed the need for the mpSizeAry unique_ptr in
    FontList. ImplFontListFontMetric::GetDevice() and mpDevice could
    also be removed as it was no longer used anywhere.

 8. After simplifying GetSizeAry(), it turns out it was the same as
    GetStdSizeAry(), so removed FontList::GetSizeAry() and used
    FontList::GetStdSizeAry() in its place.

 9. Changing to use GetStdSizeAry() revealed that FontSizeBox::Fill()
    no longer used the pFontMetric paramter, so this was removed, and
    call sites updated.

10. Due to change to Fill():

    a. SvxFontSizeBox_Base::UpdateFont() no longer uses the
       const css::awt::FontDescriptor& rCurrentFont parameter, so
       removed this. This also removed the member variable
       m_aCurrentFont

    b. SvxCharNamePage::FillSizeBox_Impl() had a number of newly
       unused variables removed.

    c. SwStdFontTabPage::Reset() and
       SwStdFontTabPage::LoseFocusHdl() had a number of newly unused
       variables removed.

Change-Id: If840e240155c36ed351c63e3136b5b44bb058697
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121932
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Chris Sherlock
2021-09-21 07:54:59 +02:00
committed by Mike Kaganski
parent 4bd0902087
commit f5a81a119c
20 changed files with 30 additions and 201 deletions
+1 -10
View File
@@ -563,27 +563,19 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox)
const FontList* pFontList = GetFontList();
DBG_ASSERT( pFontList, "no fontlist" );
FontStyleBox* pStyleBox = nullptr;
FontSizeBox* pSizeBox = nullptr;
OUString sFontName;
if (m_xWestFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xWestFontStyleLB.get();
pSizeBox = m_xWestFontSizeLB.get();
sFontName = m_xWestFontNameLB->get_active_text();
}
else if (m_xEastFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xEastFontStyleLB.get();
pSizeBox = m_xEastFontSizeLB.get();
sFontName = m_xEastFontNameLB->get_active_text();
}
else if (m_xCTLFontNameLB.get() == &rNameBox)
{
pStyleBox = m_xCTLFontStyleLB.get();
pSizeBox = m_xCTLFontSizeLB.get();
sFontName = m_xCTLFontNameLB->get_active_text();
}
else
{
@@ -591,8 +583,7 @@ void SvxCharNamePage::FillSizeBox_Impl(const weld::Widget& rNameBox)
return;
}
FontMetric _aFontMetric(pFontList->Get(sFontName, pStyleBox->get_active_text()));
pSizeBox->Fill( &_aFontMetric, pFontList );
pSizeBox->Fill( pFontList );
}
namespace
+1 -1
View File
@@ -4692,7 +4692,7 @@ static char* getFonts (const char* pCommand)
{
boost::property_tree::ptree aChildren;
const FontMetric& rFontMetric = pList->GetFontName(i);
const int* pAry = pList->GetSizeAry(rFontMetric);
const int* pAry = FontList::GetStdSizeAry();
sal_uInt16 nSizeCount = 0;
while (pAry[nSizeCount])
{
+1 -3
View File
@@ -1480,7 +1480,6 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
return false;
static const sal_uInt16 gFontSizeWichMap[] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL, 0 };
const SvxFontItem& rFontItem = rSet.Get(EE_CHAR_FONTINFO);
bool bRet = false;
const sal_uInt16* pWhich = gFontSizeWichMap;
@@ -1491,8 +1490,7 @@ bool EditView::ChangeFontSize( bool bGrow, SfxItemSet& rSet, const FontList* pFo
const MapUnit eUnit = rSet.GetPool()->GetMetric( *pWhich );
nHeight = OutputDevice::LogicToLogic(nHeight * 10, eUnit, MapUnit::MapPoint);
FontMetric aFontMetric = pFontList->Get( rFontItem.GetFamilyName(), rFontItem.GetStyleName() );
const int* pAry = pFontList->GetSizeAry( aFontMetric );
const int* pAry = FontList::GetStdSizeAry();
if( bGrow )
{
@@ -159,13 +159,11 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
if ( !pFontList )
pFontList.reset(new FontList( Application::GetDefaultDevice() ));
FontMetric aFontMetric = pFontList->Get( m_aFontDescriptor.Name, m_aFontDescriptor.StyleName );
// setup font size array
m_pHeightArray.reset();
const int* pTempAry;
const int* pAry = pFontList->GetSizeAry( aFontMetric );
const int* pAry = FontList::GetStdSizeAry();
sal_uInt16 nSizeCount = 0;
while ( pAry[nSizeCount] )
nSizeCount++;
+1 -1
View File
@@ -459,7 +459,7 @@ class SVT_DLLPUBLIC FontSizeBox
public:
FontSizeBox(std::unique_ptr<weld::ComboBox> p);
void Fill(const FontMetric* pFontMetric, const FontList* pList);
void Fill(const FontList* pList);
void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep = 5);
void EnablePtRelativeMode(short nMin, short nMax, short nStep = 10);
+2 -4
View File
@@ -116,10 +116,10 @@ FontList::GetStyleName()
--------------------------------------------------------------------------
const int* FontList::GetSizeAry( const FontMetric& rFontMetric ) const;
static const int* FontList::GetStdSizeAry();
This method returns the available sizes for the given font.
If it is a scalable font, standard sizes are returned.
As all fonts are scalable, standard sizes are returned.
The array contains the heights of the font in tenth (1/10) point.
The last value of the array is 0.
The returned array will destroyed by the FontList.
@@ -144,7 +144,6 @@ private:
OUString maBoldItalic;
OUString maBlack;
OUString maBlackItalic;
mutable std::unique_ptr<int[]> mpSizeAry;
VclPtr<OutputDevice> mpDev;
VclPtr<OutputDevice> mpDev2;
std::vector<std::unique_ptr<ImplFontListNameInfo>> m_Entries;
@@ -185,7 +184,6 @@ public:
static sal_Handle GetNextFontMetric( sal_Handle hFontMetric );
static const FontMetric& GetFontMetric( sal_Handle hFontMetric );
const int* GetSizeAry( const FontMetric& rFontMetric ) const;
static const int* GetStdSizeAry() { return aStdSizeAry; }
private:
-3
View File
@@ -1115,9 +1115,6 @@ public:
bool IsFontAvailable( const OUString& rFontName ) const;
Size GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) const;
int GetDevFontSizeCount( const vcl::Font& ) const;
bool AddTempDevFont( const OUString& rFileURL, const OUString& rFontName );
void RefreshFontData( const bool bNewFontLists );
+3 -11
View File
@@ -1079,7 +1079,7 @@ IMPL_LINK(FontSizeBox, ModifyHdl, weld::ComboBox&, rBox, void)
m_aChangeHdl.Call(rBox);
}
void FontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList )
void FontSizeBox::Fill( const FontList* pList )
{
// remember for relative mode
pFontList = pList;
@@ -1092,15 +1092,7 @@ void FontSizeBox::Fill( const FontMetric* pFontMetric, const FontList* pList )
const int* pTempAry;
const int* pAry = nullptr;
if( pFontMetric )
{
aFontMetric = *pFontMetric;
pAry = pList->GetSizeAry( *pFontMetric );
}
else
{
pAry = FontList::GetStdSizeAry();
}
pAry = FontList::GetStdSizeAry();
// first insert font size names (for simplified/traditional chinese)
FontSizeNames aFontSizeNames( Application::GetSettings().GetUILanguageTag().getLanguageType() );
@@ -1245,7 +1237,7 @@ void FontSizeBox::SetRelative( bool bNewRelative )
SetRange(20, 9999);
SetUnit(FieldUnit::POINT);
if ( pFontList)
Fill( &aFontMetric, pFontList );
Fill( pFontList );
}
set_active_or_entry_text(aStr);
+4 -51
View File
@@ -79,17 +79,14 @@ class ImplFontListFontMetric : public FontMetric
friend FontList;
private:
VclPtr<OutputDevice> mpDevice;
ImplFontListFontMetric* mpNext;
public:
ImplFontListFontMetric( const FontMetric& rInfo,
OutputDevice* pDev ) :
FontMetric( rInfo ), mpDevice(pDev), mpNext(nullptr)
ImplFontListFontMetric( const FontMetric& rInfo ) :
FontMetric( rInfo ), mpNext(nullptr)
{
}
OutputDevice* GetDevice() const { return mpDevice; }
};
enum class FontListFontNameType
@@ -100,7 +97,6 @@ enum class FontListFontNameType
};
}
namespace o3tl
{
template<> struct typed_flags<FontListFontNameType> : is_typed_flags<FontListFontNameType, 0x3> {};
@@ -274,7 +270,7 @@ void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData)
{
if ( bInsertData )
{
ImplFontListFontMetric* pNewInfo = new ImplFontListFontMetric( aFontMetric, pDevice );
ImplFontListFontMetric* pNewInfo = new ImplFontListFontMetric( aFontMetric );
pData = new ImplFontListNameInfo( aSearchName );
pData->mpFirst = pNewInfo;
pNewInfo->mpNext = nullptr;
@@ -293,7 +289,7 @@ void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData)
bool bInsert = true;
ImplFontListFontMetric* pPrev = nullptr;
ImplFontListFontMetric* pTemp = pData->mpFirst;
ImplFontListFontMetric* pNewInfo = new ImplFontListFontMetric( aFontMetric, pDevice );
ImplFontListFontMetric* pNewInfo = new ImplFontListFontMetric( aFontMetric );
while ( pTemp )
{
sal_Int32 eComp = ImplCompareFontMetric( pNewInfo, pTemp );
@@ -744,49 +740,6 @@ const FontMetric& FontList::GetFontMetric( sal_Handle hFontMetric )
return *pInfo;
}
const int* FontList::GetSizeAry( const FontMetric& rInfo ) const
{
// first delete Size-Array
mpSizeAry.reset();
// use standard sizes if no name
if ( rInfo.GetFamilyName().isEmpty() )
return aStdSizeAry;
// first search fontname in order to use device from the matching font
OutputDevice* pDevice = mpDev;
ImplFontListNameInfo* pData = ImplFindByName( rInfo.GetFamilyName() );
if ( pData )
pDevice = pData->mpFirst->GetDevice();
int nDevSizeCount = pDevice->GetDevFontSizeCount( rInfo );
if ( !nDevSizeCount ||
(pDevice->GetDevFontSize( rInfo, 0 ).Height() == 0) )
return aStdSizeAry;
MapMode aOldMapMode = pDevice->GetMapMode();
MapMode aMap( MapUnit::Map10thInch, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
pDevice->SetMapMode( aMap );
int nRealCount = 0;
tools::Long nOldHeight = 0;
mpSizeAry.reset(new int[nDevSizeCount+1] );
for (int i = 0; i < nDevSizeCount; ++i)
{
Size aSize = pDevice->GetDevFontSize( rInfo, i );
if ( aSize.Height() != nOldHeight )
{
nOldHeight = aSize.Height();
mpSizeAry[nRealCount] = nOldHeight;
nRealCount++;
}
}
mpSizeAry[nRealCount] = 0;
pDevice->SetMapMode( aOldMapMode );
return mpSizeAry.get();
}
struct ImplFSNameItem
{
sal_Int32 mnSize;
+7 -19
View File
@@ -87,7 +87,6 @@ class FontHeightToolBoxControl : public svt::ToolboxController,
VclPtr<SvxFontSizeBox_Impl> m_xVclBox;
std::unique_ptr<SvxFontSizeBox_Base> m_xWeldBox;
SvxFontSizeBox_Base* m_pBox;
css::awt::FontDescriptor m_aCurrentFont;
};
class SvxFontSizeBox_Base
@@ -107,7 +106,7 @@ public:
}
void statusChanged_Impl(tools::Long nHeight, bool bErase);
void UpdateFont(const css::awt::FontDescriptor& rCurrentFont);
void UpdateFont();
protected:
FontHeightToolBoxControl& m_rCtrl;
@@ -251,24 +250,14 @@ void SvxFontSizeBox_Base::statusChanged_Impl( tools::Long nPoint, bool bErase )
m_aCurText = m_xWidget->get_active_text();
}
void SvxFontSizeBox_Base::UpdateFont(const css::awt::FontDescriptor& rCurrentFont)
void SvxFontSizeBox_Base::UpdateFont()
{
// filling up the sizes list
auto nOldVal = m_xWidget->get_value(); // memorize old value
FontList aFontList(Application::GetDefaultDevice());
if (!rCurrentFont.Name.isEmpty())
{
FontMetric aFontMetric;
aFontMetric.SetFamilyName(rCurrentFont.Name);
aFontMetric.SetStyleName(rCurrentFont.StyleName);
aFontMetric.SetFontHeight(rCurrentFont.Height);
m_xWidget->Fill(&aFontMetric, &aFontList);
}
else
{
m_xWidget->Fill(nullptr, &aFontList);
}
m_xWidget->Fill(&aFontList);
m_xWidget->set_value(nOldVal); // restore old value
m_aCurText = m_xWidget->get_active_text(); // memorize to reset at ESC
}
@@ -455,8 +444,7 @@ void SAL_CALL FontHeightToolBoxControl::statusChanged(
}
else if ( rEvent.FeatureURL.Path == "CharFontName" )
{
if ( rEvent.State >>= m_aCurrentFont )
m_pBox->UpdateFont( m_aCurrentFont );
m_pBox->UpdateFont();
}
}
@@ -494,7 +482,7 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
m_xWeldBox.reset(new SvxFontSizeBox_Base(std::move(xWidget), m_xFrame, *this));
m_pBox = m_xWeldBox.get();
//Get the box to fill itself with all its sizes
m_pBox->UpdateFont(m_aCurrentFont);
m_pBox->UpdateFont();
}
else
{
@@ -505,7 +493,7 @@ uno::Reference< awt::XWindow > SAL_CALL FontHeightToolBoxControl::createItemWind
m_xVclBox = VclPtr<SvxFontSizeBox_Impl>::Create( pParent, m_xFrame, *this );
m_pBox = m_xVclBox.get();
//Get the box to fill itself with all its sizes
m_pBox->UpdateFont(m_aCurrentFont);
m_pBox->UpdateFont();
//Make it size itself to its optimal size re above sizes
m_xVclBox->SetOptimalSize();
xItemWindow = VCLUnoHelper::GetInterface(m_xVclBox);
+8 -13
View File
@@ -884,16 +884,11 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
m_xLabelBox->set_entry_text(sCapBackup );
m_xIdxBox->set_entry_text(sIdxBackup );
FontMetric aFontMetric( m_pFontList->Get(sStdBackup, sStdBackup) );
m_xStandardHeightLB->Fill( &aFontMetric, m_pFontList.get() );
aFontMetric = m_pFontList->Get(sOutBackup, sOutBackup );
m_xTitleHeightLB->Fill( &aFontMetric, m_pFontList.get() );
aFontMetric = m_pFontList->Get(sListBackup,sListBackup);
m_xListHeightLB->Fill( &aFontMetric, m_pFontList.get() );
aFontMetric = m_pFontList->Get(sCapBackup, sCapBackup );
m_xLabelHeightLB->Fill( &aFontMetric, m_pFontList.get() );
aFontMetric = m_pFontList->Get(sIdxBackup, sIdxBackup );
m_xIndexHeightLB->Fill( &aFontMetric, m_pFontList.get() );
m_xStandardHeightLB->Fill( m_pFontList.get() );
m_xTitleHeightLB->Fill( m_pFontList.get() );
m_xListHeightLB->Fill( m_pFontList.get() );
m_xLabelHeightLB->Fill( m_pFontList.get() );
m_xIndexHeightLB->Fill( m_pFontList.get() );
m_xStandardHeightLB->set_value( CalcToPoint( nStandardHeight, MapUnit::MapTwip, 10 ) );
m_xTitleHeightLB->set_value( CalcToPoint( nTitleHeight , MapUnit::MapTwip, 10 ) );
@@ -976,7 +971,7 @@ IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, weld::Widget&, rControl, void )
{
weld::ComboBox& rBox = dynamic_cast<weld::ComboBox&>(rControl);
FontSizeBox* pHeightLB = nullptr;
const OUString sEntry = rBox.get_active_text();
if (&rBox == m_xStandardBox.get())
{
pHeightLB = m_xStandardHeightLB.get();
@@ -997,8 +992,8 @@ IMPL_LINK( SwStdFontTabPage, LoseFocusHdl, weld::Widget&, rControl, void )
{
pHeightLB = m_xIndexHeightLB.get();
}
FontMetric aFontMetric( m_pFontList->Get(sEntry, sEntry) );
pHeightLB->Fill( &aFontMetric, m_pFontList.get() );
pHeightLB->Fill( m_pFontList.get() );
}
void SwStdFontTabPage::PageCreated( const SfxAllItemSet& aSet)
-1
View File
@@ -67,7 +67,6 @@ public:
// misc utilities
std::shared_ptr<PhysicalFontCollection> Clone() const;
std::unique_ptr<vcl::font::PhysicalFontFaceCollection> GetFontFaceCollection() const;
std::unique_ptr<ImplDeviceFontSizeList> GetDeviceFontSizeList( const OUString& rFontName ) const;
private:
mutable bool mbMatchData; // true if matching attributes are initialized
-5
View File
@@ -66,8 +66,6 @@ class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelp
public:
virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const FontSelectPattern&) const = 0;
int GetHeight() const { return mnHeight; }
int GetWidth() const { return mnWidth; }
virtual sal_IntPtr GetFontId() const = 0;
virtual FontCharMapRef GetFontCharMap() const = 0;
virtual bool GetFontCapabilities(vcl::FontCapabilities&) const = 0;
@@ -77,9 +75,6 @@ public:
protected:
explicit PhysicalFontFace(const FontAttributes&);
tools::Long mnWidth; // Width (in pixels)
tools::Long mnHeight; // Height (in pixels)
};
#endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
-1
View File
@@ -72,7 +72,6 @@ public:
const OUString& GetAliasNames() const { return maMapNames; }
int GetMinQuality() const { return mnMinQuality; }
FontTypeFaces GetTypeFaces() const { return mnTypeFaces; }
void GetFontHeights(o3tl::sorted_vector<int>& rHeights) const;
const OUString& GetMatchFamilyName() const { return maMatchFamilyName; }
ImplFontAttrs GetMatchType() const { return mnMatchType; }
-4
View File
@@ -56,10 +56,6 @@ void VclPhysicalFontFamilyTest::testCreateFontFamily()
CPPUNIT_ASSERT_EQUAL_MESSAGE("Min quality", -1, aFamily.GetMinQuality());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Type faces", FontTypeFaces::NONE, aFamily.GetTypeFaces());
o3tl::sorted_vector<int> aHeights;
aFamily.GetFontHeights(aHeights);
CPPUNIT_ASSERT_EQUAL_MESSAGE("Number font heights", static_cast<size_t>(0), aHeights.size());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Match family name", OUString(""), aFamily.GetMatchFamilyName());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Match type", ImplFontAttrs::None, aFamily.GetMatchType());
CPPUNIT_ASSERT_EQUAL_MESSAGE("Match weight", WEIGHT_DONTKNOW, aFamily.GetMatchWeight());
@@ -901,23 +901,6 @@ std::unique_ptr<vcl::font::PhysicalFontFaceCollection> PhysicalFontCollection::G
return pDeviceFontList;
}
std::unique_ptr<ImplDeviceFontSizeList> PhysicalFontCollection::GetDeviceFontSizeList( const OUString& rFontName ) const
{
std::unique_ptr<ImplDeviceFontSizeList> pDeviceFontSizeList(new ImplDeviceFontSizeList);
vcl::font::PhysicalFontFamily* pFontFamily = FindFontFamily( rFontName );
if( pFontFamily != nullptr )
{
o3tl::sorted_vector<int> rHeights;
pFontFamily->GetFontHeights( rHeights );
for( const auto& rHeight : rHeights )
pDeviceFontSizeList->Add( rHeight );
}
return pDeviceFontSizeList;
}
// These are the metric-compatible replacement fonts that are bundled with
// LibreOffice, we prefer them over generic substitutions that might be
// provided by the system.
-2
View File
@@ -30,8 +30,6 @@
PhysicalFontFace::PhysicalFontFace( const FontAttributes& rDFA )
: FontAttributes( rDFA )
, mnWidth(0)
, mnHeight(0)
{
// StarSymbol is a unicode font, but it still deserves the symbol flag
if( !IsSymbolFont() )
-10
View File
@@ -248,16 +248,6 @@ void PhysicalFontFamily::UpdateDevFontList( vcl::font::PhysicalFontFaceCollectio
}
}
void PhysicalFontFamily::GetFontHeights( o3tl::sorted_vector<int>& rHeights ) const
{
// add all available font heights
for (auto const& font : maFontFaces)
{
PhysicalFontFace *pFoundFontFace = font.get();
rHeights.insert( pFoundFontFace->GetHeight() );
}
}
void PhysicalFontFamily::UpdateCloneFontList(PhysicalFontCollection& rFontCollection) const
{
OUString aFamilyName = GetEnglishSearchFontName( GetFamilyName() );
-39
View File
@@ -132,45 +132,6 @@ bool OutputDevice::IsFontAvailable( const OUString& rFontName ) const
return (pFound != nullptr);
}
int OutputDevice::GetDevFontSizeCount( const vcl::Font& rFont ) const
{
mpDeviceFontSizeList.reset();
ImplInitFontList();
mpDeviceFontSizeList = mxFontCollection->GetDeviceFontSizeList( rFont.GetFamilyName() );
return mpDeviceFontSizeList->Count();
}
Size OutputDevice::GetDevFontSize( const vcl::Font& rFont, int nSizeIndex ) const
{
// check range
int nCount = GetDevFontSizeCount( rFont );
if ( nSizeIndex >= nCount )
return Size();
// when mapping is enabled round to .5 points
Size aSize( 0, mpDeviceFontSizeList->Get( nSizeIndex ) );
if ( mbMap )
{
aSize.setHeight( aSize.Height() * 10 );
MapMode aMap( MapUnit::Map10thInch, Point(), Fraction( 1, 72 ), Fraction( 1, 72 ) );
aSize = PixelToLogic( aSize, aMap );
aSize.AdjustHeight(5 );
aSize.setHeight( aSize.Height() / 10 );
tools::Long nRound = aSize.Height() % 5;
if ( nRound >= 3 )
aSize.AdjustHeight(5-nRound);
else
aSize.AdjustHeight( -nRound );
aSize.setHeight( aSize.Height() * 10 );
aSize = LogicToPixel( aSize, aMap );
aSize = PixelToLogic( aSize );
aSize.AdjustHeight(5 );
aSize.setHeight( aSize.Height() / 10 );
}
return aSize;
}
bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFontName )
{
ImplInitFontList();
+1 -3
View File
@@ -192,10 +192,8 @@ bool WinGlyphFallbackSubstititution::HasMissingChars(PhysicalFontFace* pFace, OU
FontCharMapRef xFontCharMap = pWinFont->GetFontCharMap();
if( !xFontCharMap.is() )
{
// construct a Size structure as the parameter of constructor of class FontSelectPattern
const Size aSize( pFace->GetWidth(), pFace->GetHeight() );
// create a FontSelectPattern object for getting s LOGFONT
const FontSelectPattern aFSD( *pFace, aSize, static_cast<float>(aSize.Height()), 0, false );
const FontSelectPattern aFSD( *pFace, Size(), 0.0, 0, false );
// construct log font
LOGFONTW aLogFont;
ImplGetLogFontFromFontSelect( aFSD, pFace, aLogFont );