summaryrefslogtreecommitdiff
path: root/vcl/source/font/fontmetric.cxx
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2021-09-08 12:07:48 +1000
committerMike Kaganski <mike.kaganski@collabora.com>2021-09-18 11:51:52 +0200
commitc2e6a068c112f4c5866b6371d02362bd71f903a3 (patch)
treefcfdccb4ded2c743a39ed466d825326743d2f165 /vcl/source/font/fontmetric.cxx
parent9c289cfde6891eebac46270774ac5c16af093622 (diff)
vcl: create FontMetric from PhysicalFontFace
A FontMetric can be created from a PhysicalFontFace, so setup a constructor that takes a PhysicalFontFace object to instantiate the FontMetric. The OutputDevice functions GetDevFont() and GetDevFontCount() don't necessarily make much sense, so have changed GetDevFont() to GetFontMetricFromCollection() and GetDevFontCount() to GetFontFaceCollectionCount(). Change-Id: I1577679b949a49a7cf1248838786d0f5e84a5245 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121796 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source/font/fontmetric.cxx')
-rw-r--r--vcl/source/font/fontmetric.cxx15
1 files changed, 15 insertions, 0 deletions
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()
{
}