当前位置: 首页>>代码示例>>Java>>正文


Java Paint.getTypeface方法代码示例

本文整理汇总了Java中android.graphics.Paint.getTypeface方法的典型用法代码示例。如果您正苦于以下问题:Java Paint.getTypeface方法的具体用法?Java Paint.getTypeface怎么用?Java Paint.getTypeface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.graphics.Paint的用法示例。


在下文中一共展示了Paint.getTypeface方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.getShader();

    paint.setTypeface(tf);
}
 
开发者ID:pan2yong22,项目名称:AndroidUtilCode-master,代码行数:23,代码来源:SpanUtils.java

示例2: applyCustomTypeFace

import android.graphics.Paint; //导入方法依赖的package包/类
private static void applyCustomTypeFace(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(tf);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:CustomTypefaceSpan.java

示例3: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint)
{
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0)
    {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0)
    {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
开发者ID:cdjalel,项目名称:QuranKeyboard,代码行数:19,代码来源:CustomTypefaceSpan.java

示例4: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private static void apply(Paint paint, Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(tf);
}
 
开发者ID:hoangkien0705,项目名称:Android-UtilCode,代码行数:21,代码来源:SpannableStringUtils.java

示例5: applyCustomTypeFace

import android.graphics.Paint; //导入方法依赖的package包/类
private static void applyCustomTypeFace(Paint paint, @Nullable Typeface tf) {
    if (tf == null) {
        return;
    }

    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(tf);
}
 
开发者ID:coopese,项目名称:qmui,代码行数:25,代码来源:QMUICustomTypefaceSpan.java

示例6: draw

import android.graphics.Paint; //导入方法依赖的package包/类
public void draw(Canvas g2, float x, float y) {
		drawDebug(g2, x, y);
//		Paint st=AjLatexMath.getPaint();
//		st.setTextSize(AjLatexMath.getTextSize());
		Paint st =new Paint();
		float w = st.getStrokeWidth();
		Style s = st.getStyle();
		Typeface f = st.getTypeface();
		st.setStrokeWidth(0);//
		st.setStyle(Style.FILL_AND_STROKE);
		st.setTypeface(font);
		g2.save();
		g2.translate(x, y);
		g2.scale(0.5f * size, 0.5f * size);
//		g2.drawText(str, x, y, st);
		g2.drawText(str, 0, 0, st);
		g2.restore();
		st.setStyle(s);
		st.setStrokeWidth(w);
		st.setTypeface(f);
	}
 
开发者ID:daquexian,项目名称:FlexibleRichTextView,代码行数:22,代码来源:JavaFontRenderingBox.java

示例7: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint, final Typeface tf) {
    int oldStyle;
    Typeface old = paint.getTypeface();
    if (old == null) {
        oldStyle = 0;
    } else {
        oldStyle = old.getStyle();
    }

    int fake = oldStyle & ~tf.getStyle();
    if ((fake & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fake & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.getShader();

    paint.setTypeface(tf);
}
 
开发者ID:Wilshion,项目名称:HeadlineNews,代码行数:23,代码来源:SpanUtils.java

示例8: applyFontStyle

import android.graphics.Paint; //导入方法依赖的package包/类
public static void applyFontStyle(Paint paint, int style, int weight, String family) {
  int oldStyle;
  Typeface typeface = paint.getTypeface();
  if (typeface == null) {
    oldStyle = 0;
  } else {
    oldStyle = typeface.getStyle();
  }

  int want = 0;
  if ((weight == Typeface.BOLD)
    || ((oldStyle & Typeface.BOLD) != 0 && weight == WXStyle.UNSET)) {
    want |= Typeface.BOLD;
  }

  if ((style == Typeface.ITALIC)
    || ((oldStyle & Typeface.ITALIC) != 0 && style == WXStyle.UNSET)) {
    want |= Typeface.ITALIC;
  }

  if (family != null) {
    typeface = getOrCreateTypeface(family, want);
  }

  if (typeface != null) {
    paint.setTypeface(Typeface.create(typeface, want));
  } else {
    paint.setTypeface(Typeface.defaultFromStyle(want));
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:31,代码来源:TypefaceUtil.java

示例9: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private void apply(final Paint paint) {
    final Typeface oldTypeface = paint.getTypeface();
    final int oldStyle = oldTypeface != null ? oldTypeface.getStyle() : 0;
    final int fakeStyle = oldStyle & ~typeface.getStyle();

    if ((fakeStyle & Typeface.BOLD) != 0) {
        paint.setFakeBoldText(true);
    }

    if ((fakeStyle & Typeface.ITALIC) != 0) {
        paint.setTextSkewX(-0.25f);
    }

    paint.setTypeface(typeface);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:16,代码来源:CalligraphyTypefaceSpan.java

示例10: getCharGeometryCacheKey

import android.graphics.Paint; //导入方法依赖的package包/类
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:15,代码来源:TypefaceUtils.java

示例11: apply

import android.graphics.Paint; //导入方法依赖的package包/类
private static void apply(
    Paint paint,
    int style,
    int weight,
    @Nullable String family,
    AssetManager assetManager) {
  int oldStyle;
  Typeface typeface = paint.getTypeface();
  if (typeface == null) {
    oldStyle = 0;
  } else {
    oldStyle = typeface.getStyle();
  }

  int want = 0;
  if ((weight == Typeface.BOLD) ||
      ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
    want |= Typeface.BOLD;
  }

  if ((style == Typeface.ITALIC) ||
      ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
    want |= Typeface.ITALIC;
  }

  if (family != null) {
    typeface = ReactFontManager.getInstance().getTypeface(family, want, assetManager);
  } else if (typeface != null) {
    // TODO(t9055065): Fix custom fonts getting applied to text children with different style
    typeface = Typeface.create(typeface, want);
  }

  if (typeface != null) {
    paint.setTypeface(typeface);
  } else {
    paint.setTypeface(Typeface.defaultFromStyle(want));
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:39,代码来源:CustomStyleSpan.java

示例12: d

import android.graphics.Paint; //导入方法依赖的package包/类
protected Typeface d(Paint paint) {
    Object obj;
    Typeface typeface;
    Paint paint2;
    if (this.useHanyiColorFont || !(paint instanceof ETPaint)) {
        obj = null;
        typeface = null;
        paint2 = paint;
    } else {
        paint = ((ETPaint) paint).a();
        Typeface typeface2 = paint.getTypeface();
        paint.setTypeface(null);
        typeface = typeface2;
        obj = 1;
        paint2 = paint;
    }
    if (!this.useDefaultFont) {
        return typeface;
    }
    if (paint2 instanceof ETPaint) {
        paint2 = ((ETPaint) paint2).a();
    }
    if (obj != null) {
        return typeface;
    }
    typeface = paint2.getTypeface();
    paint2.setTypeface(null);
    return typeface;
}
 
开发者ID:xieyangxuejun,项目名称:CommentView,代码行数:30,代码来源:TextCell.java


注:本文中的android.graphics.Paint.getTypeface方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。