• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_GRAPHICS_PAINT_H
18 #define ANDROID_GRAPHICS_PAINT_H
19 
20 #include <SkPaint.h>
21 #include <string>
22 
23 #include <minikin/FontFamily.h>
24 
25 namespace android {
26 
27 class Paint : public SkPaint {
28 public:
29     Paint();
30     Paint(const Paint& paint);
31     ~Paint();
32 
33     Paint& operator=(const Paint& other);
34 
35     friend bool operator==(const Paint& a, const Paint& b);
36     friend bool operator!=(const Paint& a, const Paint& b) {
37         return !(a == b);
38     }
39 
setLetterSpacing(float letterSpacing)40     void setLetterSpacing(float letterSpacing) {
41         mLetterSpacing = letterSpacing;
42     }
43 
getLetterSpacing()44     float getLetterSpacing() const {
45         return mLetterSpacing;
46     }
47 
setFontFeatureSettings(const std::string & fontFeatureSettings)48     void setFontFeatureSettings(const std::string &fontFeatureSettings) {
49         mFontFeatureSettings = fontFeatureSettings;
50     }
51 
getFontFeatureSettings()52     std::string getFontFeatureSettings() const {
53         return mFontFeatureSettings;
54     }
55 
setTextLocale(const std::string & textLocale)56     void setTextLocale(const std::string &textLocale) {
57         mTextLocale = textLocale;
58     }
59 
getTextLocale()60     std::string getTextLocale() const {
61         return mTextLocale;
62     }
63 
setFontVariant(FontVariant variant)64     void setFontVariant(FontVariant variant) {
65         mFontVariant = variant;
66     }
67 
getFontVariant()68     FontVariant getFontVariant() const {
69         return mFontVariant;
70     }
71 
72 private:
73     float mLetterSpacing;
74     std::string mFontFeatureSettings;
75     std::string mTextLocale;
76     FontVariant mFontVariant;
77 };
78 
79 }  // namespace android
80 
81 #endif // ANDROID_GRAPHICS_PAINT_H
82