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
This commit is contained in:
parent
0650c6ca12
commit
069b827f8e
@ -29,8 +29,7 @@ class SkWStream;
|
||||
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 @@ public:
|
||||
/** 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 @@ public:
|
||||
@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
|
||||
|
@ -90,10 +90,11 @@ static SkMaskFilter* makemf() { return new Darken(0x30); }
|
||||
|
||||
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 @@ public:
|
||||
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));
|
||||
|
@ -382,7 +382,8 @@ protected:
|
||||
|
||||
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);
|
||||
|
@ -35,7 +35,8 @@ class TypefaceView : public SkView {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ bool SkTypeface::Equal(const SkTypeface* facea, const SkTypeface* faceb) {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user