• 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 
operator ==(TextShadow const & rhs) const36 bool TextShadow::operator ==(TextShadow const &rhs) const
37 {
38     return offsetX == rhs.offsetX &&
39            offsetY == rhs.offsetY &&
40            color == rhs.color &&
41            blurLeave == rhs.blurLeave;
42 }
43 
operator ==(TextStyle const & rhs) const44 bool TextStyle::operator ==(TextStyle const &rhs) const
45 {
46     return color == rhs.color &&
47            fontSize == rhs.fontSize &&
48            fontFamilies == rhs.fontFamilies &&
49            heightOnly == rhs.heightOnly &&
50            heightScale == rhs.heightScale &&
51            decoration == rhs.decoration &&
52            decorationColor == rhs.decorationColor &&
53            decorationStyle == rhs.decorationStyle &&
54            decorationThicknessScale == rhs.decorationThicknessScale &&
55            shadows == rhs.shadows &&
56            foreground == rhs.foreground &&
57            background == rhs.background &&
58            fontWeight == rhs.fontWeight &&
59            fontStyle == rhs.fontStyle &&
60            fontFeature == rhs.fontFeature &&
61            letterSpacing == rhs.letterSpacing &&
62            wordSpacing == rhs.wordSpacing;
63 }
64 } // namespace TextEngine
65 } // namespace Rosen
66 } // namespace OHOS
67