diff options
author | Khaled Hosny <khaled@aliftype.com> | 2022-09-20 07:02:18 +0200 |
---|---|---|
committer | خالد حسني <khaled@aliftype.com> | 2022-09-20 11:59:55 +0200 |
commit | 06a23b7b4d23a31a4808c68f00e1be42d8218737 (patch) | |
tree | 323c826f13326b1796b1d51ffff0c96ecc968afe /vcl/inc/font | |
parent | 80550ade305b9e68c6281a258d162bc2c413713a (diff) |
vcl: Add PhysicalFontFace::GetName()
Change-Id: I91cc7bd0b9c9ce8d59a31d17a354fb3f2be29499
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140219
Tested-by: Jenkins
Reviewed-by: خالد حسني <khaled@aliftype.com>
Diffstat (limited to 'vcl/inc/font')
-rw-r--r-- | vcl/inc/font/FeatureCollector.hxx | 8 | ||||
-rw-r--r-- | vcl/inc/font/PhysicalFontFace.hxx | 36 |
2 files changed, 41 insertions, 3 deletions
diff --git a/vcl/inc/font/FeatureCollector.hxx b/vcl/inc/font/FeatureCollector.hxx index ae784474e06d..0ffb5f9d424c 100644 --- a/vcl/inc/font/FeatureCollector.hxx +++ b/vcl/inc/font/FeatureCollector.hxx @@ -15,19 +15,23 @@ #include <hb.h> #include <i18nlangtag/lang.h> +#include <font/PhysicalFontFace.hxx> + namespace vcl::font { class FeatureCollector { private: + const PhysicalFontFace* m_pFace; hb_face_t* m_pHbFace; std::vector<vcl::font::Feature>& m_rFontFeatures; const LanguageTag& m_rLanguageTag; public: - FeatureCollector(hb_face_t* pHbFace, std::vector<vcl::font::Feature>& rFontFeatures, + FeatureCollector(const PhysicalFontFace* pFace, std::vector<vcl::font::Feature>& rFontFeatures, const LanguageTag& rLanguageTag) - : m_pHbFace(pHbFace) + : m_pFace(pFace) + , m_pHbFace(pFace->GetHbFace()) , m_rFontFeatures(rFontFeatures) , m_rLanguageTag(rLanguageTag) { diff --git a/vcl/inc/font/PhysicalFontFace.hxx b/vcl/inc/font/PhysicalFontFace.hxx index 303976c59776..5cdf88bd3ac9 100644 --- a/vcl/inc/font/PhysicalFontFace.hxx +++ b/vcl/inc/font/PhysicalFontFace.hxx @@ -21,8 +21,9 @@ #include <sal/config.h> -#include <salhelper/simplereferenceobject.hxx> +#include <i18nlangtag/languagetag.hxx> #include <rtl/ref.hxx> +#include <salhelper/simplereferenceobject.hxx> #include <tools/color.hxx> #include <tools/long.hxx> #include <vcl/dllapi.h> @@ -93,6 +94,36 @@ struct ColorLayer typedef std::vector<Color> ColorPalette; +// https://learn.microsoft.com/en-us/typography/opentype/spec/name#name-ids +typedef enum { + NAME_ID_COPYRIGHT = 0, + NAME_ID_FONT_FAMILY = 1, + NAME_ID_FONT_SUBFAMILY = 2, + NAME_ID_UNIQUE_ID = 3, + NAME_ID_FULL_NAME = 4, + NAME_ID_VERSION_STRING = 5, + NAME_ID_POSTSCRIPT_NAME = 6, + NAME_ID_TRADEMARK = 7, + NAME_ID_MANUFACTURER = 8, + NAME_ID_DESIGNER = 9, + NAME_ID_DESCRIPTION = 10, + NAME_ID_VENDOR_URL = 11, + NAME_ID_DESIGNER_URL = 12, + NAME_ID_LICENSE = 13, + NAME_ID_LICENSE_URL = 14, + //NAME_ID_RESERVED = 15, + NAME_ID_TYPOGRAPHIC_FAMILY = 16, + NAME_ID_TYPOGRAPHIC_SUBFAMILY = 17, + NAME_ID_MAC_FULL_NAME = 18, + NAME_ID_SAMPLE_TEXT = 19, + NAME_ID_CID_FINDFONT_NAME = 20, + NAME_ID_WWS_FAMILY = 21, + NAME_ID_WWS_SUBFAMILY = 22, + NAME_ID_LIGHT_BACKGROUND = 23, + NAME_ID_DARK_BACKGROUND = 24, + NAME_ID_VARIATIONS_PS_PREFIX = 25, +} NameID; + // TODO: no more direct access to members // TODO: get rid of height/width for scalable fonts // TODO: make cloning cheaper @@ -140,6 +171,9 @@ public: uint32_t UnitsPerEm() const { return hb_face_get_upem(GetHbFace()); } + OUString GetName(NameID, const LanguageTag&) const; + OUString GetName(NameID aNameID) const { return GetName(aNameID, LanguageTag(LANGUAGE_NONE)); } + virtual hb_face_t* GetHbFace() const; virtual hb_blob_t* GetHbTable(hb_tag_t) const { |