TypefaceImpl.h revision a033630e805c407080221e20b236b6054f324670
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_TYPEFACE_IMPL_H 19#define ANDROID_TYPEFACE_IMPL_H 20 21#include <androidfw/AssetManager.h> 22 23#ifdef USE_MINIKIN 24#include <minikin/FontCollection.h> 25#endif 26 27namespace android { 28 29#ifdef USE_MINIKIN 30struct TypefaceImpl { 31 FontCollection *fFontCollection; 32 FontStyle fStyle; 33}; 34 35// Note: it would be cleaner if the following functions were member 36// functions (static or otherwise) of the TypefaceImpl class. However, 37// that can't be easily accommodated in the case where TypefaceImpl 38// is just a pointer to SkTypeface, in the non-USE_MINIKIN case. 39// TODO: when #ifdef USE_MINIKIN is removed, move to member functions. 40 41TypefaceImpl* TypefaceImpl_resolveDefault(TypefaceImpl* src); 42#else 43typedef SkTypeface TypefaceImpl; 44#endif 45 46TypefaceImpl* TypefaceImpl_createFromTypeface(TypefaceImpl* src, SkTypeface::Style style); 47 48TypefaceImpl* TypefaceImpl_createFromName(const char* name, SkTypeface::Style style); 49 50TypefaceImpl* TypefaceImpl_createFromFile(const char* filename); 51 52TypefaceImpl* TypefaceImpl_createFromAsset(Asset* asset); 53 54void TypefaceImpl_unref(TypefaceImpl* face); 55 56int TypefaceImpl_getStyle(TypefaceImpl* face); 57 58} 59 60#endif // ANDROID_TYPEFACE_IMPL_H