SK_C_API size_t sk_typeface_get_table_size(sk_typeface_t* typeface, sk_font_table_tag_t tag);
SK_C_API size_t sk_typeface_get_table_data(sk_typeface_t* typeface, sk_font_table_tag_t tag, size_t offset, size_t length, void* data);
+SK_C_API sk_fontmgr_t* sk_fontmgr_ref_default();
+SK_C_API void sk_fontmgr_unref(sk_fontmgr_t*);
+SK_C_API int sk_fontmgr_count_families(sk_fontmgr_t*);
+SK_C_API void sk_fontmgr_get_family_name(sk_fontmgr_t*, int index, sk_string_t* familyName);
+SK_C_API sk_typeface_t* sk_fontmgr_match_family_style_character(sk_fontmgr_t*, const char* familyName, int weight, int width, sk_font_style_slant_t slant, const char** bcp47, int bcp47Count, int32_t character);
+
SK_C_PLUS_PLUS_END_GUARD
#endif
*/
typedef struct sk_typeface_t sk_typeface_t;
typedef uint32_t sk_font_table_tag_t;
+typedef struct sk_fontmgr_t sk_fontmgr_t;
/**
* Abstraction layer directly on top of an image codec.
*/
*/
#include "SkTypeface.h"
+#include "SkFontMgr.h"
+#include "SkFontStyle.h"
#include "sk_typeface.h"
{
return AsTypeface(typeface)->getTableData(tag, offset, length, data);
}
+
+sk_fontmgr_t* sk_fontmgr_ref_default()
+{
+ return ToFontMgr(SkFontMgr::RefDefault());
+}
+
+void sk_fontmgr_unref(sk_fontmgr_t* fontmgr)
+{
+ AsFontMgr(fontmgr)->unref();
+}
+
+int sk_fontmgr_count_families(sk_fontmgr_t* fontmgr)
+{
+ return AsFontMgr(fontmgr)->countFamilies();
+}
+
+void sk_fontmgr_get_family_name(sk_fontmgr_t* fontmgr, int index, sk_string_t* familyName)
+{
+ AsFontMgr(fontmgr)->getFamilyName(index, AsString(familyName));
+}
+
+sk_typeface_t* sk_fontmgr_match_family_style_character(sk_fontmgr_t* fontmgr, const char* familyName, int weight, int width, sk_font_style_slant_t slant, const char** bcp47, int bcp47Count, int32_t character)
+{
+ SkFontStyle style = SkFontStyle(weight, width, (SkFontStyle::Slant)slant);
+ SkTypeface* typeface = AsFontMgr(fontmgr)->matchFamilyStyleCharacter(familyName, style, bcp47, bcp47Count, character);
+ return ToTypeface(typeface);
+}
+
#include "SkPathOps.h"
#include "SkRegion.h"
#include "SkTypeface.h"
+#include "SkFontMgr.h"
#include "SkEncodedInfo.h"
#include "SkTime.h"
#include "SkCamera.h"
return reinterpret_cast<sk_typeface_t*>(typeface);
}
+static inline SkFontMgr* AsFontMgr(sk_fontmgr_t* fontmgr) {
+ return reinterpret_cast<SkFontMgr*>(fontmgr);
+}
+
+static inline sk_fontmgr_t* ToFontMgr(SkFontMgr* fontmgr) {
+ return reinterpret_cast<sk_fontmgr_t*>(fontmgr);
+}
+
static inline sk_colorspace_t* ToColorSpace(SkColorSpace* colorspace) {
return reinterpret_cast<sk_colorspace_t*>(colorspace);
}