summaryrefslogtreecommitdiff
path: root/vcl/inc/font
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2021-09-12 14:41:19 +1000
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-05 18:11:01 +0200
commitc817a5a4958c323eb189e1374072998b8b13ba8c (patch)
tree0345dd9e4ae0b590a184b354e9fb183dbcd27f09 /vcl/inc/font
parent0e736b0c20e096c5daf59f141b4509cfcc159a79 (diff)
vcl: test PhysicalFontFace and move to vcl::font namespace
- moved PhysicalFontFace.hxx to vcl/inc/font - added PhysicalFontFace to vcl::font namespace - had to regenerate precompiled_vcl.hxx - tested PhysicalFontFace, with some extensive tests for IsBetterMatch() Change-Id: I860022ac244f8a827f6f9cb7ed9018c5d9c328cb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121970 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/inc/font')
-rw-r--r--vcl/inc/font/FontSelectPattern.hxx1
-rw-r--r--vcl/inc/font/PhysicalFontFace.hxx91
-rw-r--r--vcl/inc/font/PhysicalFontFaceCollection.hxx2
-rw-r--r--vcl/inc/font/PhysicalFontFamily.hxx5
4 files changed, 95 insertions, 4 deletions
diff --git a/vcl/inc/font/FontSelectPattern.hxx b/vcl/inc/font/FontSelectPattern.hxx
index 077c1c941996..78be730130f1 100644
--- a/vcl/inc/font/FontSelectPattern.hxx
+++ b/vcl/inc/font/FontSelectPattern.hxx
@@ -36,6 +36,7 @@ class Size;
namespace vcl::font
{
+class PhysicalFontFace;
class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes
{
diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx
new file mode 100644
index 000000000000..0fa71de0af44
--- /dev/null
+++ b/vcl/inc/font/PhysicalFontFace.hxx
@@ -0,0 +1,91 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
+#define INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
+
+#include <sal/config.h>
+
+#include <salhelper/simplereferenceobject.hxx>
+#include <rtl/ref.hxx>
+#include <tools/long.hxx>
+#include <vcl/dllapi.h>
+#include <vcl/fontcharmap.hxx>
+
+#include <fontattributes.hxx>
+
+class LogicalFontInstance;
+struct FontMatchStatus;
+namespace vcl::font
+{
+class FontSelectPattern;
+}
+class PhysicalFontFace;
+
+namespace vcl
+{
+struct FontCapabilities;
+class PhysicalFontFamily;
+}
+
+namespace vcl::font
+{
+class FontSelectPattern;
+
+struct FontMatchStatus
+{
+public:
+ int mnFaceMatch;
+ int mnHeightMatch;
+ int mnWidthMatch;
+ const OUString* mpTargetStyleName;
+};
+
+// TODO: no more direct access to members
+// TODO: get rid of height/width for scalable fonts
+// TODO: make cloning cheaper
+
+/**
+ * abstract base class for physical font faces
+ *
+ * It acts as a factory for its corresponding LogicalFontInstances and
+ * can be extended to cache device and font instance specific data.
+ */
+class VCL_PLUGIN_PUBLIC PhysicalFontFace : public FontAttributes, public salhelper::SimpleReferenceObject
+{
+public:
+ virtual rtl::Reference<LogicalFontInstance> CreateFontInstance(const vcl::font::FontSelectPattern&) const = 0;
+
+ virtual sal_IntPtr GetFontId() const = 0;
+ virtual FontCharMapRef GetFontCharMap() const = 0;
+ virtual bool GetFontCapabilities(vcl::FontCapabilities&) const = 0;
+
+ bool IsBetterMatch( const vcl::font::FontSelectPattern&, FontMatchStatus& ) const;
+ sal_Int32 CompareIgnoreSize( const PhysicalFontFace& ) const;
+
+protected:
+ explicit PhysicalFontFace(const FontAttributes&);
+};
+
+}
+
+#endif // INCLUDED_VCL_INC_PHYSICALFONTFACE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+
diff --git a/vcl/inc/font/PhysicalFontFaceCollection.hxx b/vcl/inc/font/PhysicalFontFaceCollection.hxx
index 9b4622690bfb..c9e3e64b6640 100644
--- a/vcl/inc/font/PhysicalFontFaceCollection.hxx
+++ b/vcl/inc/font/PhysicalFontFaceCollection.hxx
@@ -23,7 +23,7 @@
#include <vcl/dllapi.h>
-#include <PhysicalFontFace.hxx>
+#include "PhysicalFontFace.hxx"
#include <vector>
diff --git a/vcl/inc/font/PhysicalFontFamily.hxx b/vcl/inc/font/PhysicalFontFamily.hxx
index d807c4f648e5..a3c4d0b90a31 100644
--- a/vcl/inc/font/PhysicalFontFamily.hxx
+++ b/vcl/inc/font/PhysicalFontFamily.hxx
@@ -28,9 +28,6 @@
#include <unotools/fontcfg.hxx>
-#include <PhysicalFontFace.hxx>
-
-class PhysicalFontFace;
class PhysicalFontCollection;
namespace vcl::font
@@ -59,6 +56,8 @@ struct typed_flags<vcl::font::FontTypeFaces> : is_typed_flags<vcl::font::FontTyp
namespace vcl::font
{
+class FontSelectPattern;
+class PhysicalFontFace;
class PhysicalFontFaceCollection;
class VCL_PLUGIN_PUBLIC PhysicalFontFamily