1 /* 2 * Copyright 2011 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkTypeface_win_DEFINED 9 #define SkTypeface_win_DEFINED 10 11 #include "include/core/SkRefCnt.h" 12 #include "include/core/SkTypeface.h" 13 #include "include/core/SkTypes.h" 14 15 #ifdef SK_BUILD_FOR_WIN 16 17 #ifdef UNICODE 18 typedef struct tagLOGFONTW LOGFONTW; 19 typedef LOGFONTW LOGFONT; 20 #else 21 typedef struct tagLOGFONTA LOGFONTA; 22 typedef LOGFONTA LOGFONT; 23 #endif // UNICODE 24 25 /** 26 * Like the other Typeface create methods, this returns a new reference to the 27 * corresponding typeface for the specified logfont. The caller is responsible 28 * for calling unref() when it is finished. 29 */ 30 SK_API sk_sp<SkTypeface> SkCreateTypefaceFromLOGFONT(const LOGFONT&); 31 32 /** 33 * Copy the LOGFONT associated with this typeface into the lf parameter. Note 34 * that the lfHeight will need to be set afterwards, since the typeface does 35 * not track this (the paint does). 36 * typeface may be NULL, in which case we return the logfont for the default font. 37 */ 38 SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf); 39 40 /** 41 * Set an optional callback to ensure that the data behind a LOGFONT is loaded. 42 * This will get called if Skia tries to access the data but hits a failure. 43 * Normally this is null, and is only required if the font data needs to be 44 * remotely (re)loaded. 45 */ 46 SK_API void SkTypeface_SetEnsureLOGFONTAccessibleProc(void (*)(const LOGFONT&)); 47 48 // Experimental! 49 // 50 class SkFontMgr; 51 struct IDWriteFactory; 52 struct IDWriteFontCollection; 53 struct IDWriteFontFallback; 54 55 SK_API sk_sp<SkFontMgr> SkFontMgr_New_GDI(); 56 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory = nullptr, 57 IDWriteFontCollection* collection = nullptr); 58 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory, 59 IDWriteFontCollection* collection, 60 IDWriteFontFallback* fallback); 61 62 #endif // SK_BUILD_FOR_WIN 63 #endif // SkTypeface_win_DEFINED 64