Java Code Examples for android.text.TextPaint#reset()
The following examples show how to use
android.text.TextPaint#reset() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RNTextSizeModule.java From react-native-text-size with BSD 2-Clause "Simplified" License | 6 votes |
/** * https://stackoverflow.com/questions/27631736 * /meaning-of-top-ascent-baseline-descent-bottom-and-leading-in-androids-font */ @SuppressWarnings("unused") @ReactMethod public void fontFromSpecs(@Nullable final ReadableMap specs, final Promise promise) { final RNTextSizeConf conf = getConf(specs, promise); if (conf == null) { return; } final Typeface typeface = RNTextSizeConf.getFont(mReactContext, conf.fontFamily, conf.fontStyle); final TextPaint textPaint = sTextPaintInstance; final int fontSize = (int) Math.ceil(conf.scale(conf.fontSize)); textPaint.reset(); textPaint.setTypeface(typeface); textPaint.setTextSize(fontSize); promise.resolve(fontInfoFromTypeface(textPaint, typeface, conf)); }
Example 2
Source File: AndroidDisplayer.java From letv with Apache License 2.0 | 6 votes |
private synchronized TextPaint getPaint(BaseDanmaku danmaku, boolean quick) { TextPaint paint; if (quick) { paint = this.PAINT_DUPLICATE; paint.set(this.PAINT); } else { paint = this.PAINT; } paint.reset(); paint.setTextSize(danmaku.textSize); applyTextScaleConfig(danmaku, paint); if (!this.HAS_SHADOW || this.SHADOW_RADIUS <= 0.0f || danmaku.textShadowColor == 0) { paint.clearShadowLayer(); } else { paint.setShadowLayer(this.SHADOW_RADIUS, 0.0f, 0.0f, danmaku.textShadowColor); } paint.setAntiAlias(this.ANTI_ALIAS); return paint; }