TypefaceImpl.h revision 3660789f06c5fbcb81e6c7c79612048bff8f0f66
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 "jni.h" // for jlong, eventually remove 22#include "SkTypeface.h" 23#include <androidfw/AssetManager.h> 24 25#include <minikin/FontCollection.h> 26 27namespace android { 28 29struct TypefaceImpl { 30 FontCollection *fFontCollection; 31 FontStyle fStyle; 32}; 33 34// Note: it would be cleaner if the following functions were member 35// functions (static or otherwise) of the TypefaceImpl class. However, 36// that can't be easily accommodated in the case where TypefaceImpl 37// is just a pointer to SkTypeface, in the non-USE_MINIKIN case. 38// TODO: when #ifdef USE_MINIKIN is removed, move to member functions. 39 40TypefaceImpl* TypefaceImpl_resolveDefault(TypefaceImpl* src); 41 42TypefaceImpl* TypefaceImpl_createFromTypeface(TypefaceImpl* src, SkTypeface::Style style); 43 44// When we remove the USE_MINIKIN ifdef, probably a good idea to move the casting 45// (from jlong to FontFamily*) to the caller in Typeface.cpp. 46TypefaceImpl* TypefaceImpl_createFromFamilies(const jlong* families, size_t size); 47 48void TypefaceImpl_unref(TypefaceImpl* face); 49 50int TypefaceImpl_getStyle(TypefaceImpl* face); 51 52void TypefaceImpl_setDefault(TypefaceImpl* face); 53 54} 55 56#endif // ANDROID_TYPEFACE_IMPL_H