export function to return a typeface's LOGFONT
git-svn-id: http://skia.googlecode.com/svn/trunk@1903 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h
index 88678d1..79683d0 100644
--- a/include/ports/SkTypeface_win.h
+++ b/include/ports/SkTypeface_win.h
@@ -25,7 +25,15 @@
* corresponding typeface for the specified logfont. The caller is responsible
* for calling unref() when it is finished.
*/
-SK_API extern SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&);
+SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&);
+
+/**
+ * Copy the LOGFONT associated with this typeface into the lf parameter. Note
+ * that the lfHeight will need to be set afterwards, since the typeface does
+ * not track this (the paint does).
+ * typeface may be NULL, in which case we return the logfont for the default font.
+ */
+SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf);
#endif
diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp
index 3d057e7..01d2421 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -160,6 +160,17 @@
return face;
}
+/**
+ * This guy is public
+ */
+void SkLOGFONTFromTypeface(const SkTypeface* face, LOGFONT* lf) {
+ if (NULL == face) {
+ *lf = get_default_font();
+ } else {
+ *lf = ((const LogFontTypeface*)face)->fLogFont;
+ }
+}
+
SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID) {
// Zero means that we don't have any fallback fonts for this fontID.
// This function is implemented on Android, but doesn't have much