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 
18 #ifndef _ANDROID_GRAPHICS_TYPEFACE_IMPL_H_
19 #define _ANDROID_GRAPHICS_TYPEFACE_IMPL_H_
20 
21 #include "SkTypeface.h"
22 
23 #include <cutils/compiler.h>
24 #include <minikin/FontCollection.h>
25 #include <vector>
26 
27 namespace android {
28 
29 struct ANDROID_API Typeface {
30     FontCollection *fFontCollection;
31 
32     // style used for constructing and querying Typeface objects
33     SkTypeface::Style fSkiaStyle;
34     // base weight in CSS-style units, 100..900
35     int fBaseWeight;
36 
37     // resolved style actually used for rendering
38     FontStyle fStyle;
39 
40     void unref();
41 
42     static Typeface* resolveDefault(Typeface* src);
43 
44     static Typeface* createFromTypeface(Typeface* src, SkTypeface::Style style);
45 
46     static Typeface* createWeightAlias(Typeface* src, int baseweight);
47 
48     static Typeface* createFromFamilies(const std::vector<FontFamily*>& families);
49 
50     static void setDefault(Typeface* face);
51 };
52 
53 }
54 
55 #endif  // _ANDROID_GRAPHICS_TYPEFACE_IMPL_H_
56