summaryrefslogtreecommitdiff
path: root/vcl/source/font/Feature.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2018-06-23 16:01:19 +0200
committerTomaž Vajngerl <quikee@gmail.com>2018-06-24 15:33:44 +0200
commita7af4bbbc0793fb78aea6a89f8fb6dc052710a11 (patch)
tree12a0711925e58904895f7a5a0cea7a6dafc04266 /vcl/source/font/Feature.cxx
parent04645273d7c9dd6927035b571464148a38d3db9f (diff)
vcl: treat description of cv** & ss** font features specially
To avoid adding descriptions for each of font features cv** and ss**, where ** is a number between 00-99, process them separately and just use one description for each. This simplifies translation as we don't need to add 99 copy-paste translations but add a bit more complexity when looking up the descriptions. Change-Id: Ia6e9554af20355c90c73afeec33fd18c694865b9 Reviewed-on: https://gerrit.libreoffice.org/56317 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/font/Feature.cxx')
-rw-r--r--vcl/source/font/Feature.cxx15
1 files changed, 13 insertions, 2 deletions
diff --git a/vcl/source/font/Feature.cxx b/vcl/source/font/Feature.cxx
index 1b7545b560b9..a23a85fae952 100644
--- a/vcl/source/font/Feature.cxx
+++ b/vcl/source/font/Feature.cxx
@@ -76,9 +76,11 @@ FeatureDefinition::FeatureDefinition(sal_uInt32 nCode, OUString const& rDescript
{
}
-FeatureDefinition::FeatureDefinition(sal_uInt32 nCode, const char* pDescriptionID)
+FeatureDefinition::FeatureDefinition(sal_uInt32 nCode, const char* pDescriptionID,
+ OUString const& rNumericPart)
: m_nCode(nCode)
, m_pDescriptionID(pDescriptionID)
+ , m_sNumericPart(rNumericPart)
, m_eType(FeatureParameterType::BOOL)
{
}
@@ -100,11 +102,20 @@ const std::vector<FeatureParameter>& FeatureDefinition::getEnumParameters() cons
OUString FeatureDefinition::getDescription() const
{
if (m_pDescriptionID)
- return VclResId(m_pDescriptionID);
+ {
+ OUString sTranslatedDescription = VclResId(m_pDescriptionID);
+ if (!m_sNumericPart.isEmpty())
+ return sTranslatedDescription.replaceFirst("%1", m_sNumericPart);
+ return sTranslatedDescription;
+ }
else if (!m_sDescription.isEmpty())
+ {
return m_sDescription;
+ }
else
+ {
return vcl::font::featureCodeAsString(m_nCode);
+ }
}
sal_uInt32 FeatureDefinition::getCode() const { return m_nCode; }