API cleanup: rename typeface Create to CreateFromName, and remove default arg
git-svn-id: http://skia.googlecode.com/svn/trunk@108 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkTypeface.h b/include/core/SkTypeface.h
index 72a0af1..b25aeea 100644
--- a/include/core/SkTypeface.h
+++ b/include/core/SkTypeface.h
@@ -29,8 +29,7 @@
textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify
how text appears when drawn (and measured).
- Typeface objects are immutable, and so they can be shred between threads.
- To enable this, Typeface inherits from the thread-safe version of SkRefCnt.
+ Typeface objects are immutable, and so they can be shared between threads.
*/
class SkTypeface : public SkRefCnt {
public:
@@ -48,9 +47,6 @@
/** Returns the typeface's intrinsic style attributes
*/
Style style() const { return fStyle; }
-
- /** DEPRECATED */
- Style getStyle() const { return this->style(); }
/** Returns true if getStyle() has the kBold bit set.
*/
@@ -84,7 +80,7 @@
@return reference to the closest-matching typeface. Call must call
unref() when they are done.
*/
- static SkTypeface* Create(const char familyName[], Style style = kNormal);
+ static SkTypeface* CreateFromName(const char familyName[], Style style);
/** Return a new reference to the typeface that most closely matches the
requested typeface and specified Style. Use this call if you want to
diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
index 60e015a..b8abac3 100644
--- a/samplecode/SampleText.cpp
+++ b/samplecode/SampleText.cpp
@@ -90,10 +90,11 @@
static void test_typefaceCache()
{
- SkTypeface* t0 = SkTypeface::Create("sans-serif", SkTypeface::kNormal);
- SkTypeface* t1 = SkTypeface::Create(NULL, SkTypeface::kNormal);
- SkTypeface* t2 = SkTypeface::Create("arial", SkTypeface::kNormal);
- SkTypeface* t3 = SkTypeface::Create("helvetica", SkTypeface::kItalic);
+ SkTypeface* t0 = SkTypeface::CreateFromName("sans-serif",
+ SkTypeface::kNormal);
+ SkTypeface* t1 = SkTypeface::CreateFromName(NULL, SkTypeface::kNormal);
+ SkTypeface* t2 = SkTypeface::CreateFromName("arial", SkTypeface::kNormal);
+ SkTypeface* t3 = SkTypeface::CreateFromName("helvetica", SkTypeface::kItalic);
#ifndef SK_BUILD_FOR_MAC
SkASSERT(t0 == t1);
@@ -413,7 +414,8 @@
static const char extra[] = { '.', ',', ':', ';', '!' };
SkPaint paint, paint2;
- paint2.setTypeface(SkTypeface::Create(NULL, SkTypeface::kItalic))->unref();
+ paint2.setTypeface(SkTypeface::CreateFromName(NULL,
+ SkTypeface::kItalic))->unref();
for (int i = 0; i < 26; i++)
::dump('a' + i, count_char_points(paint, 'a' + i), count_char_points(paint2, 'a' + i));
diff --git a/samplecode/SampleTextEffects.cpp b/samplecode/SampleTextEffects.cpp
index 2293a04..f64e187 100644
--- a/samplecode/SampleTextEffects.cpp
+++ b/samplecode/SampleTextEffects.cpp
@@ -382,7 +382,8 @@
paint.setAntiAlias(true);
paint.setTextSize(SkIntToScalar(48));
- paint.setTypeface(SkTypeface::Create("sans-serif", SkTypeface::kBold));
+ paint.setTypeface(SkTypeface::CreateFromName("sans-serif",
+ SkTypeface::kBold));
SkString str("GOOGLE ");
str.appendUnichar(0x5700);
diff --git a/samplecode/SampleTypeface.cpp b/samplecode/SampleTypeface.cpp
index 94023b7..b1289bd 100644
--- a/samplecode/SampleTypeface.cpp
+++ b/samplecode/SampleTypeface.cpp
@@ -35,7 +35,8 @@
public:
TypefaceView() {
for (int i = 0; i < gFaceCount; i++) {
- fFaces[i] = SkTypeface::Create(gFaces[i].fName, gFaces[i].fStyle);
+ fFaces[i] = SkTypeface::CreateFromName(gFaces[i].fName,
+ gFaces[i].fStyle);
}
}
diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp
index 1f2078e..bb91776 100644
--- a/src/core/SkTypeface.cpp
+++ b/src/core/SkTypeface.cpp
@@ -20,7 +20,7 @@
///////////////////////////////////////////////////////////////////////////////
-SkTypeface* SkTypeface::Create(const char name[], Style style) {
+SkTypeface* SkTypeface::CreateFromName(const char name[], Style style) {
SkTypeface* face = SkFontHost::FindTypeface(NULL, name, style);
face->ref();
return face;