/* -*- 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 .
*/
bool bRet = maLatinFont.getFontData( aFontName, nFontPitch, nFontFamily, nullptr, rFilter ); if (!bRet) // In case there is no direct font, try to look it up as a theme reference.
bRet = maLatinThemeFont.getFontData( aFontName, nFontPitch, nFontFamily, nullptr, rFilter ); if (bRet)
{
rPropMap.setProperty( PROP_CharFontName, aFontName);
rPropMap.setProperty( PROP_CharFontPitch, nFontPitch);
rPropMap.setProperty( PROP_CharFontFamily, nFontFamily);
}
if ( maFillProperties.moFillType.has_value() )
{
Color aColor = maFillProperties.getBestSolidColor(); bool bContoured = false;
// noFill doesn't exist for characters. Map noFill to 99% transparency if (maFillProperties.moFillType.value() == XML_noFill)
aColor.addTransformation(XML_alpha, 1000);
// tdf#137438 Emulate text outline color/transparency. // If the outline color dominates, then use it as the text color. if (moTextOutlineProperties.has_value()
&& moTextOutlineProperties.value().maLineFill.moFillType.has_value()
&& moTextOutlineProperties.value().maLineFill.moFillType.value() != XML_noFill)
{
Color aLineColor = moTextOutlineProperties.value().maLineFill.getBestSolidColor();
sal_Int16 nLineTransparency = aLineColor.getTransparency();
// tdf#127696 If the text color is white (and the outline color doesn't dominate), // then this is contoured text in LO. if (nLineTransparency < aColor.getTransparency()
|| (bContoured = aColor.getColor(rFilter.getGraphicHelper()) == COL_WHITE))
aColor = std::move(aLineColor);
}
rPropMap.setProperty(PROP_CharColor, aColor.getColor(rFilter.getGraphicHelper()));
// set theme color
model::ComplexColor aComplexColor = aColor.getComplexColor();
sal_Int32 nToken = Color::getColorMapToken(aColor.getSchemeColorName()); if (nToken != -1)
{
rFilter.getGraphicHelper().getSchemeColorToken(nToken);
model::ThemeColorType eThemeColorType = schemeTokenToThemeColorType(nToken);
aComplexColor.setThemeColor(eThemeColorType);
}
rPropMap.setProperty(PROP_CharComplexColor, model::color::createXComplexColor(aComplexColor));
rPropMap.setProperty(PROP_CharContoured, bContoured);
if (aColor.hasTransparency())
{ constauto nTransparency = aColor.getTransparency();
rPropMap.setProperty(PROP_CharTransparence, nTransparency);
// WORKAROUND: Fully transparent white has the same value as COL_AUTO, avoid collision if (nTransparency == 100
&& aColor.getColor(rFilter.getGraphicHelper()).GetRGBColor() == COL_AUTO.GetRGBColor())
rPropMap.setProperty(PROP_CharColor, ::Color(ColorTransparency, 0xFFFFFFFE));
}
}
if( moLang.has_value() && !moLang.value().isEmpty() )
{
LanguageTag aTag(moLang.value());
lang::Locale aLocale(aTag.getLocale()); switch(MsLangId::getScriptType(aTag.getLanguageType()))
{ case css::i18n::ScriptType::LATIN:
rPropMap.setProperty( PROP_CharLocale, aLocale);break; case css::i18n::ScriptType::ASIAN:
rPropMap.setProperty( PROP_CharLocaleAsian, aLocale);break; case css::i18n::ScriptType::COMPLEX:
rPropMap.setProperty( PROP_CharLocaleComplex, aLocale);break;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.