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 <cutils/compiler.h>
21
22#include <SkPaint.h>
23#include <string>
24
25#include <minikin/FontFamily.h>
26
27namespace android {
28
29class ANDROID_API Paint : public SkPaint {
30public:
31    Paint();
32    Paint(const Paint& paint);
33    Paint(const SkPaint& paint);
34    ~Paint();
35
36    Paint& operator=(const Paint& other);
37
38    friend bool operator==(const Paint& a, const Paint& b);
39    friend bool operator!=(const Paint& a, const Paint& b) {
40        return !(a == b);
41    }
42
43    void setLetterSpacing(float letterSpacing) {
44        mLetterSpacing = letterSpacing;
45    }
46
47    float getLetterSpacing() const {
48        return mLetterSpacing;
49    }
50
51    void setFontFeatureSettings(const std::string& fontFeatureSettings) {
52        mFontFeatureSettings = fontFeatureSettings;
53    }
54
55    std::string getFontFeatureSettings() const {
56        return mFontFeatureSettings;
57    }
58
59    void setMinikinLangListId(uint32_t minikinLangListId) {
60        mMinikinLangListId = minikinLangListId;
61    }
62
63    uint32_t getMinikinLangListId() const {
64        return mMinikinLangListId;
65    }
66
67    void setFontVariant(FontVariant variant) {
68        mFontVariant = variant;
69    }
70
71    FontVariant getFontVariant() const {
72        return mFontVariant;
73    }
74
75    void setHyphenEdit(uint32_t hyphen) {
76        mHyphenEdit = hyphen;
77    }
78
79    uint32_t getHyphenEdit() const {
80        return mHyphenEdit;
81    }
82
83private:
84    float mLetterSpacing = 0;
85    std::string mFontFeatureSettings;
86    uint32_t mMinikinLangListId;
87    FontVariant mFontVariant;
88    uint32_t mHyphenEdit = 0;
89};
90
91}  // namespace android
92
93#endif // ANDROID_GRAPHICS_PAINT_H_
94