summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cui/source/dialogs/cuicharmap.cxx6
-rw-r--r--framework/source/uielement/fontsizemenucontroller.cxx2
-rw-r--r--include/vcl/metric.hxx7
-rw-r--r--include/vcl/outdev.hxx4
-rw-r--r--starmath/source/document.cxx2
-rw-r--r--starmath/source/view.cxx2
-rw-r--r--svtools/source/control/ctrltool.cxx6
-rw-r--r--sw/source/ui/config/optpage.cxx4
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx4
-rw-r--r--toolkit/source/awt/vclxdevice.cxx4
-rw-r--r--vcl/source/font/fontmetric.cxx15
-rw-r--r--vcl/source/outdev/font.cxx25
-rw-r--r--vcl/workben/svptest.cxx4
13 files changed, 44 insertions, 41 deletions
diff --git a/cui/source/dialogs/cuicharmap.cxx b/cui/source/dialogs/cuicharmap.cxx
index c8bf07cc5794..acdacbd803c0 100644
--- a/cui/source/dialogs/cuicharmap.cxx
+++ b/cui/source/dialogs/cuicharmap.cxx
@@ -451,12 +451,12 @@ void SvxCharacterMap::init()
OUString aDefStr( aFont.GetFamilyName() );
OUString aLastName;
- int nCount = m_xVirDev->GetDevFontCount();
+ int nCount = m_xVirDev->GetFontFaceCollectionCount();
std::vector<weld::ComboBoxEntry> aEntries;
aEntries.reserve(nCount);
for (int i = 0; i < nCount; ++i)
{
- OUString aFontName( m_xVirDev->GetDevFont( i ).GetFamilyName() );
+ OUString aFontName( m_xVirDev->GetFontMetricFromCollection( i ).GetFamilyName() );
if (aFontName != aLastName)
{
aLastName = aFontName;
@@ -657,7 +657,7 @@ void SvxCharacterMap::insertCharToDoc(const OUString& sGlyph)
IMPL_LINK_NOARG(SvxCharacterMap, FontSelectHdl, weld::ComboBox&, void)
{
const sal_uInt32 nFont = m_xFontLB->get_active_id().toUInt32();
- aFont = m_xVirDev->GetDevFont(nFont);
+ aFont = m_xVirDev->GetFontMetricFromCollection(nFont);
aFont.SetWeight( WEIGHT_DONTKNOW );
aFont.SetItalic( ITALIC_NONE );
aFont.SetWidthType( WIDTH_DONTKNOW );
diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx
index 4a70e0ab2e5f..0a90c125ec84 100644
--- a/framework/source/uielement/fontsizemenucontroller.cxx
+++ b/framework/source/uielement/fontsizemenucontroller.cxx
@@ -150,7 +150,7 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co
if ( !aPrinterName.isEmpty() )
{
pInfoPrinter.disposeAndReset(VclPtr<Printer>::Create( aPrinterName ));
- if ( pInfoPrinter && pInfoPrinter->GetDevFontCount() > 0 )
+ if ( pInfoPrinter && pInfoPrinter->GetFontFaceCollectionCount() > 0 )
pFontList.reset(new FontList( pInfoPrinter.get() ));
}
diff --git a/include/vcl/metric.hxx b/include/vcl/metric.hxx
index 9de279fd222d..5af0629950de 100644
--- a/include/vcl/metric.hxx
+++ b/include/vcl/metric.hxx
@@ -20,12 +20,14 @@
#ifndef INCLUDED_VCL_METRIC_HXX
#define INCLUDED_VCL_METRIC_HXX
-#include <vcl/dllapi.h>
-#include <vcl/font.hxx>
#include <tools/ref.hxx>
#include <tools/gen.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/font.hxx>
+
class FontCharMap;
+class PhysicalFontFace;
typedef tools::SvRef<FontCharMap> FontCharMapRef;
@@ -34,6 +36,7 @@ class VCL_DLLPUBLIC FontMetric : public vcl::Font
public:
explicit FontMetric();
FontMetric( const FontMetric& ); // TODO make this explicit
+ FontMetric(PhysicalFontFace const& rFace);
~FontMetric() override;
tools::Long GetAscent() const { return mnAscent; }
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 54703cb88d34..d0a4ec03bd84 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1110,8 +1110,8 @@ private:
public:
- FontMetric GetDevFont( int nDevFontIndex ) const;
- int GetDevFontCount() const;
+ FontMetric GetFontMetricFromCollection( int nDevFontIndex ) const;
+ int GetFontFaceCollectionCount() const;
bool IsFontAvailable( const OUString& rFontName ) const;
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx
index 4acba208a61e..0a0646988c80 100644
--- a/starmath/source/document.cxx
+++ b/starmath/source/document.cxx
@@ -872,7 +872,7 @@ void SmDocShell::Execute(SfxRequest& rReq)
{
// get device used to retrieve the FontList
OutputDevice *pDev = GetPrinter();
- if (!pDev || pDev->GetDevFontCount() == 0)
+ if (!pDev || pDev->GetFontFaceCollectionCount() == 0)
pDev = &SM_MOD()->GetDefaultVirtualDev();
OSL_ENSURE (pDev, "device for font list missing" );
diff --git a/starmath/source/view.cxx b/starmath/source/view.cxx
index a5d427d89cdc..c82b414bb131 100644
--- a/starmath/source/view.cxx
+++ b/starmath/source/view.cxx
@@ -1937,7 +1937,7 @@ void SmViewShell::Execute(SfxRequest& rReq)
// get device used to retrieve the FontList
SmDocShell *pDoc = GetDoc();
OutputDevice *pDev = pDoc->GetPrinter();
- if (!pDev || pDev->GetDevFontCount() == 0)
+ if (!pDev || pDev->GetFontFaceCollectionCount() == 0)
pDev = &SM_MOD()->GetDefaultVirtualDev();
SAL_WARN_IF( !pDev, "starmath", "device for font list missing" );
diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx
index f9c7f30c6b97..14968cdf77f0 100644
--- a/svtools/source/control/ctrltool.cxx
+++ b/svtools/source/control/ctrltool.cxx
@@ -252,16 +252,16 @@ void FontList::ImplInsertFonts(OutputDevice* pDevice, bool bInsertData)
nType = FontListFontNameType::PRINTER;
// inquire all fonts from the device
- int n = pDevice->GetDevFontCount();
+ int n = pDevice->GetFontFaceCollectionCount();
if (n == 0 && comphelper::LibreOfficeKit::isActive())
{
pDevice->RefreshFontData(true);
- n = pDevice->GetDevFontCount();
+ n = pDevice->GetFontFaceCollectionCount();
}
for (int i = 0; i < n; ++i)
{
- FontMetric aFontMetric = pDevice->GetDevFont( i );
+ FontMetric aFontMetric = pDevice->GetFontMetricFromCollection( i );
OUString aSearchName(aFontMetric.GetFamilyName());
ImplFontListNameInfo* pData;
sal_uInt32 nIndex;
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index de601d0a6b7f..a8c7dba32850 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -766,10 +766,10 @@ void SwStdFontTabPage::Reset( const SfxItemSet* rSet)
{
// get the set of distinct available family names
std::set< OUString > aFontNames;
- int nFontNames = m_pPrt->GetDevFontCount();
+ int nFontNames = m_pPrt->GetFontFaceCollectionCount();
for( int i = 0; i < nFontNames; i++ )
{
- FontMetric aFontMetric( m_pPrt->GetDevFont( i ) );
+ FontMetric aFontMetric( m_pPrt->GetFontMetricFromCollection( i ) );
aFontNames.insert( aFontMetric.GetFamilyName() );
}
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 5ed597d7fc83..895c0398feb2 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -204,10 +204,10 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( weld::Window* pParent, SwDocShell& rDocSh,
// get the set of distinct available family names
std::set< OUString > aFontNames;
- int nFontNames = pPrt->GetDevFontCount();
+ int nFontNames = pPrt->GetFontFaceCollectionCount();
for( int i = 0; i < nFontNames; i++ )
{
- FontMetric aFontMetric( pPrt->GetDevFont( i ) );
+ FontMetric aFontMetric( pPrt->GetFontMetricFromCollection( i ) );
aFontNames.insert( aFontMetric.GetFamilyName() );
}
diff --git a/toolkit/source/awt/vclxdevice.cxx b/toolkit/source/awt/vclxdevice.cxx
index d82e1a6ec905..72b0618d5a2a 100644
--- a/toolkit/source/awt/vclxdevice.cxx
+++ b/toolkit/source/awt/vclxdevice.cxx
@@ -98,13 +98,13 @@ css::uno::Sequence< css::awt::FontDescriptor > VCLXDevice::getFontDescriptors(
css::uno::Sequence< css::awt::FontDescriptor> aFonts;
if( mpOutputDevice )
{
- int nFonts = mpOutputDevice->GetDevFontCount();
+ int nFonts = mpOutputDevice->GetFontFaceCollectionCount();
if ( nFonts )
{
aFonts = css::uno::Sequence< css::awt::FontDescriptor>( nFonts );
css::awt::FontDescriptor* pFonts = aFonts.getArray();
for ( int n = 0; n < nFonts; n++ )
- pFonts[n] = VCLUnoHelper::CreateFontDescriptor( mpOutputDevice->GetDevFont( n ) );
+ pFonts[n] = VCLUnoHelper::CreateFontDescriptor( mpOutputDevice->GetFontMetricFromCollection( n ) );
}
}
return aFonts;
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 817025286b37..03996cd7a4d8 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -24,6 +24,7 @@
#include <vcl/outdev.hxx>
#include <sal/log.hxx>
+#include <PhysicalFontFace.hxx>
#include <fontinstance.hxx>
#include <fontselect.hxx>
#include <impfontmetricdata.hxx>
@@ -50,6 +51,20 @@ FontMetric::FontMetric()
FontMetric::FontMetric( const FontMetric& rFontMetric ) = default;
+FontMetric::FontMetric(PhysicalFontFace const& rFace)
+{
+ SetFamilyName(rFace.GetFamilyName());
+ SetStyleName(rFace.GetStyleName());
+ SetCharSet(rFace.GetCharSet());
+ SetFamily(rFace.GetFamilyType());
+ SetPitch(rFace.GetPitch());
+ SetWeight(rFace.GetWeight());
+ SetItalic(rFace.GetItalic());
+ SetAlignment(TextAlign::ALIGN_TOP);
+ SetWidthType(rFace.GetWidthType());
+ SetQuality(rFace.GetQuality() );
+}
+
FontMetric::~FontMetric()
{
}
diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx
index ed6f5be095b8..e2d8d4ef471c 100644
--- a/vcl/source/outdev/font.cxx
+++ b/vcl/source/outdev/font.cxx
@@ -95,32 +95,17 @@ void OutputDevice::SetFont( const vcl::Font& rNewFont )
mpAlphaVDev->SetFont( aFont );
}
-FontMetric OutputDevice::GetDevFont( int nDevFontIndex ) const
+FontMetric OutputDevice::GetFontMetricFromCollection(int nDevFontIndex) const
{
- FontMetric aFontMetric;
-
ImplInitFontList();
- int nCount = GetDevFontCount();
- if( nDevFontIndex < nCount )
- {
- const PhysicalFontFace& rData = *mpFontFaceCollection->Get( nDevFontIndex );
- aFontMetric.SetFamilyName( rData.GetFamilyName() );
- aFontMetric.SetStyleName( rData.GetStyleName() );
- aFontMetric.SetCharSet( rData.GetCharSet() );
- aFontMetric.SetFamily( rData.GetFamilyType() );
- aFontMetric.SetPitch( rData.GetPitch() );
- aFontMetric.SetWeight( rData.GetWeight() );
- aFontMetric.SetItalic( rData.GetItalic() );
- aFontMetric.SetAlignment( TextAlign::ALIGN_TOP );
- aFontMetric.SetWidthType( rData.GetWidthType() );
- aFontMetric.SetQuality( rData.GetQuality() );
- }
+ if (nDevFontIndex < GetFontFaceCollectionCount())
+ return FontMetric(*mpFontFaceCollection->Get(nDevFontIndex));
- return aFontMetric;
+ return FontMetric();
}
-int OutputDevice::GetDevFontCount() const
+int OutputDevice::GetFontFaceCollectionCount() const
{
if( !mpFontFaceCollection )
{
diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx
index 988b0d9d164f..2bc3ad4adb7c 100644
--- a/vcl/workben/svptest.cxx
+++ b/vcl/workben/svptest.cxx
@@ -226,12 +226,12 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR
Size(aPaperSize.Width() - 600,
aPaperSize.Height() - 600)));
- const int nFontCount = rRenderContext.GetDevFontCount();
+ const int nFontCount = rRenderContext.GetFontFaceCollectionCount();
const int nFontSamples = (nFontCount < 15) ? nFontCount : 15;
for (int i = 0; i < nFontSamples; ++i)
{
- FontMetric aFont = rRenderContext.GetDevFont((i * nFontCount) / nFontSamples);
+ FontMetric aFont(rRenderContext.GetFontMetricFromCollection((i * nFontCount) / nFontSamples));
aFont.SetFontHeight(400 + (i % 7) * 100);
aFont.SetOrientation(Degree10(i * (3600 / nFontSamples)));
rRenderContext.SetFont(aFont);