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