OSDN Git Service

7a34bc291ee4c5337576aa3f718f6c58c1a8c4dc
[android-x86/frameworks-base.git] / core / jni / android / graphics / Paint.h
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
40     void setLetterSpacing(float letterSpacing) {
41         mLetterSpacing = letterSpacing;
42     }
43
44     float getLetterSpacing() const {
45         return mLetterSpacing;
46     }
47
48     void setFontFeatureSettings(const std::string &fontFeatureSettings) {
49         mFontFeatureSettings = fontFeatureSettings;
50     }
51
52     std::string getFontFeatureSettings() const {
53         return mFontFeatureSettings;
54     }
55
56     void setTextLocales(const std::string &textLocales) {
57         mTextLocales = textLocales;
58     }
59
60     const std::string& getTextLocales() const {
61         return mTextLocales;
62     }
63
64     void setFontVariant(FontVariant variant) {
65         mFontVariant = variant;
66     }
67
68     FontVariant getFontVariant() const {
69         return mFontVariant;
70     }
71
72     void setHyphenEdit(uint32_t hyphen) {
73         mHyphenEdit = hyphen;
74     }
75
76     uint32_t getHyphenEdit() const {
77         return mHyphenEdit;
78     }
79
80 private:
81     float mLetterSpacing = 0;
82     std::string mFontFeatureSettings;
83     std::string mTextLocales;
84     FontVariant mFontVariant;
85     uint32_t mHyphenEdit = 0;
86 };
87
88 }  // namespace android
89
90 #endif // ANDROID_GRAPHICS_PAINT_H_