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 "../private/SkLeanWindows.h" 12 #include "SkTypeface.h" 13 14 #ifdef SK_BUILD_FOR_WIN 15 16 /** 17 * Like the other Typeface create methods, this returns a new reference to the 18 * corresponding typeface for the specified logfont. The caller is responsible 19 * for calling unref() when it is finished. 20 */ 21 SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); 22 23 /** 24 * Copy the LOGFONT associated with this typeface into the lf parameter. Note 25 * that the lfHeight will need to be set afterwards, since the typeface does 26 * not track this (the paint does). 27 * typeface may be NULL, in which case we return the logfont for the default font. 28 */ 29 SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf); 30 31 /** 32 * Set an optional callback to ensure that the data behind a LOGFONT is loaded. 33 * This will get called if Skia tries to access the data but hits a failure. 34 * Normally this is null, and is only required if the font data needs to be 35 * remotely (re)loaded. 36 */ 37 SK_API void SkTypeface_SetEnsureLOGFONTAccessibleProc(void (*)(const LOGFONT&)); 38 39 // Experimental! 40 // 41 class SkFontMgr; 42 class SkRemotableFontMgr; 43 struct IDWriteFactory; 44 struct IDWriteFontCollection; 45 struct IDWriteFontFallback; 46 47 SK_API sk_sp<SkFontMgr> SkFontMgr_New_GDI(); 48 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory = NULL, 49 IDWriteFontCollection* collection = NULL); 50 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWrite(IDWriteFactory* factory, 51 IDWriteFontCollection* collection, 52 IDWriteFontFallback* fallback); 53 54 /** 55 * Creates an SkFontMgr which renders using DirectWrite and obtains its data 56 * from the SkRemotableFontMgr. 57 * 58 * If DirectWrite could not be initialized, will return NULL. 59 */ 60 SK_API sk_sp<SkFontMgr> SkFontMgr_New_DirectWriteRenderer(sk_sp<SkRemotableFontMgr>); 61 62 /** 63 * Creates an SkRemotableFontMgr backed by DirectWrite using the default 64 * system font collection in the current locale. 65 * 66 * If DirectWrite could not be initialized, will return NULL. 67 */ 68 SK_API sk_sp<SkRemotableFontMgr> SkRemotableFontMgr_New_DirectWrite(); 69 70 #endif // SK_BUILD_FOR_WIN 71 #endif // SkTypeface_win_DEFINED 72