Split out SkFontHost_FreeType into common files

Review URL: https://codereview.appspot.com/6442092

git-svn-id: http://skia.googlecode.com/svn/trunk@5246 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h
new file mode 100644
index 0000000..d5f2c08
--- /dev/null
+++ b/src/ports/SkFontHost_FreeType_common.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2006-2012 The Android Open Source Project
+ * Copyright 2012 Mozilla Foundation
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SKFONTHOST_FREETYPE_COMMON_H_
+#define SKFONTHOST_FREETYPE_COMMON_H_
+
+#include "SkGlyph.h"
+#include "SkScalerContext.h"
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+#ifdef SK_DEBUG
+    #define SkASSERT_CONTINUE(pred)                                                         \
+        do {                                                                                \
+            if (!(pred))                                                                    \
+                SkDebugf("file %s:%d: assert failed '" #pred "'\n", __FILE__, __LINE__);    \
+        } while (false)
+#else
+    #define SkASSERT_CONTINUE(pred)
+#endif
+
+
+class SkScalerContext_FreeType_Base : public SkScalerContext {
+public:
+    // See http://freetype.sourceforge.net/freetype2/docs/reference/ft2-bitmap_handling.html#FT_Bitmap_Embolden
+    // This value was chosen by eyeballing the result in Firefox and trying to match it.
+    static const FT_Pos kBitmapEmboldenStrength = 1 << 6;
+
+    SkScalerContext_FreeType_Base(const SkDescriptor *desc)
+        : SkScalerContext(desc)
+    {}
+
+protected:
+    void generateGlyphImage(FT_Face face, const SkGlyph& glyph, SkMaskGamma::PreBlend* maskPreBlend);
+    void generateGlyphPath(FT_Face face, const SkGlyph& glyph, SkPath* path);
+    void emboldenOutline(FT_Face face, FT_Outline* outline);
+};
+
+#endif // SKFONTHOST_FREETYPE_COMMON_H_