float dx = 0, dy = 0, r = 0;
boolean elegant = false;
float letterSpacing = 0;
+ String fontFeatureSettings = null;
final Resources.Theme theme = context.getTheme();
case com.android.internal.R.styleable.TextAppearance_letterSpacing:
letterSpacing = appearance.getFloat(attr, 0);
break;
+
+ case com.android.internal.R.styleable.TextAppearance_fontFeatureSettings:
+ fontFeatureSettings = appearance.getString(attr);
+ break;
}
}
case com.android.internal.R.styleable.TextView_letterSpacing:
letterSpacing = a.getFloat(attr, 0);
break;
+
+ case com.android.internal.R.styleable.TextView_fontFeatureSettings:
+ fontFeatureSettings = a.getString(attr);
+ break;
}
}
a.recycle();
setRawTextSize(textSize);
setElegantTextHeight(elegant);
setLetterSpacing(letterSpacing);
+ setFontFeatureSettings(fontFeatureSettings);
if (allCaps) {
setTransformationMethod(new AllCapsTransformationMethod(getContext()));
com.android.internal.R.styleable.TextAppearance_letterSpacing, 0));
}
+ if (appearance.hasValue(com.android.internal.R.styleable.TextAppearance_fontFeatureSettings)) {
+ setFontFeatureSettings(appearance.getString(
+ com.android.internal.R.styleable.TextAppearance_fontFeatureSettings));
+ }
+
appearance.recycle();
}
* This will normally be 0.
*
* @see #setLetterSpacing(float)
+ * @see Paint#setLetterSpacing
* @hide
*/
public float getLetterSpacing() {
* for slight expansion will be around 0.05. Negative values tighten text.
*
* @see #getLetterSpacing()
- * @see Paint#setFlags
+ * @see Paint#getLetterSpacing
*
* @attr ref android.R.styleable#TextView_letterSpacing
* @hide
}
}
+ /**
+ * @return the currently set font feature settings. Default is null.
+ *
+ * @see #setFontFeatureSettings(String)
+ * @see Paint#setFontFeatureSettings
+ * @hide
+ */
+ public String getFontFeatureSettings() {
+ return mTextPaint.getFontFeatureSettings();
+ }
+
+ /**
+ * Sets font feature settings. The format is the same as the CSS
+ * font-feature-settings attribute:
+ * http://dev.w3.org/csswg/css-fonts/#propdef-font-feature-settings
+ *
+ * @see #getFontFeatureSettings()
+ * @see Paint#getFontFeatureSettings
+ *
+ * @attr ref android.R.styleable#TextView_fontFeatureSettings
+ * @hide
+ */
+ @android.view.RemotableViewMethod
+ public void setFontFeatureSettings(String fontFeatureSettings) {
+ if (fontFeatureSettings != mTextPaint.getFontFeatureSettings()) {
+ mTextPaint.setFontFeatureSettings(fontFeatureSettings);
+
+ if (mLayout != null) {
+ nullLayouts();
+ requestLayout();
+ invalidate();
+ }
+ }
+ }
+
/**
* Sets the text color for all the states (normal, selected,
<attr name="elegantTextHeight" format="boolean" />
<!-- Text letter-spacing. -->
<attr name="letterSpacing" format="float" />
+ <!-- Font feature settings. -->
+ <attr name="fontFeatureSettings" format="string" />
</declare-styleable>
<declare-styleable name="TextClock">
<!-- Specifies the formatting pattern used to show the time and/or date
<attr name="elegantTextHeight" />
<!-- Text letter-spacing. -->
<attr name="letterSpacing" />
+ <!-- Font feature settings. -->
+ <attr name="fontFeatureSettings" />
</declare-styleable>
<declare-styleable name="TextViewAppearance">
<!-- Base text color, typeface, size, and style. -->