aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-19 19:08:33 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-07-19 19:08:33 +0000
commitdb77a6a9a9bef7033aca9dffa99d52be1f51f8d9 (patch)
tree656ed293f3deae5cd9fb16133802caa56ba101d5
parent29c612928b26ec73c78a67313e86726fd1300ca9 (diff)
export function to return a typeface's LOGFONT
git-svn-id: http://skia.googlecode.com/svn/trunk@1903 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/ports/SkTypeface_win.h10
-rwxr-xr-xsrc/ports/SkFontHost_win.cpp11
2 files changed, 20 insertions, 1 deletions
diff --git a/include/ports/SkTypeface_win.h b/include/ports/SkTypeface_win.h
index 88678d1241..79683d016a 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 3d057e7729..01d2421443 100755
--- a/src/ports/SkFontHost_win.cpp
+++ b/src/ports/SkFontHost_win.cpp
@@ -160,6 +160,17 @@ SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT& origLF) {
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