• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "texgine/text_style.h"
17 
18 namespace OHOS {
19 namespace Rosen {
20 namespace TextEngine {
SetFeature(const std::string & ftag,int fvalue)21 void FontFeatures::SetFeature(const std::string &ftag, int fvalue)
22 {
23     features_[ftag] = fvalue;
24 }
25 
GetFeatures() const26 const std::map<std::string, int> &FontFeatures::GetFeatures() const
27 {
28     return features_;
29 }
30 
operator ==(const FontFeatures & rhs) const31 bool FontFeatures::operator ==(const FontFeatures &rhs) const
32 {
33     return features_ == rhs.features_;
34 }
35 
HasShadow() const36 bool TextShadow::HasShadow() const
37 {
38     return blurLeave > 0 || offsetX != 0 || offsetY != 0;
39 }
40 
operator ==(TextShadow const & rhs) const41 bool TextShadow::operator ==(TextShadow const &rhs) const
42 {
43     return offsetX == rhs.offsetX &&
44            offsetY == rhs.offsetY &&
45            color == rhs.color &&
46            blurLeave == rhs.blurLeave;
47 }
48 
operator ==(TextStyle const & rhs) const49 bool TextStyle::operator ==(TextStyle const &rhs) const
50 {
51     return color == rhs.color &&
52            fontSize == rhs.fontSize &&
53            fontFamilies == rhs.fontFamilies &&
54            halfLeading == rhs.halfLeading &&
55            heightOnly == rhs.heightOnly &&
56            heightScale == rhs.heightScale &&
57            decoration == rhs.decoration &&
58            decorationColor == rhs.decorationColor &&
59            decorationStyle == rhs.decorationStyle &&
60            decorationThicknessScale == rhs.decorationThicknessScale &&
61            shadows == rhs.shadows &&
62            fontWeight == rhs.fontWeight &&
63            fontStyle == rhs.fontStyle &&
64            fontFeature == rhs.fontFeature &&
65            letterSpacing == rhs.letterSpacing &&
66            wordSpacing == rhs.wordSpacing &&
67            foreground == rhs.foreground &&
68            background == rhs.background &&
69            backgroundRect == rhs.backgroundRect &&
70            styleId == rhs.styleId &&
71            isSymbolGlyph == rhs.isSymbolGlyph &&
72            symbol == rhs.symbol;
73 }
74 } // namespace TextEngine
75 } // namespace Rosen
76 } // namespace OHOS
77