Package icyllis.modernui.text.style
Class TypefaceSpan
java.lang.Object
icyllis.modernui.text.style.CharacterStyle
icyllis.modernui.text.style.MetricAffectingSpan
icyllis.modernui.text.style.TypefaceSpan
- All Implemented Interfaces:
icyllis.modernui.text.ParcelableSpan,UpdateAppearance,UpdateLayout,Parcelable,Cloneable
public class TypefaceSpan
extends MetricAffectingSpan
implements icyllis.modernui.text.ParcelableSpan
-
Nested Class Summary
Nested classes/interfaces inherited from interface icyllis.modernui.util.Parcelable
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>, Parcelable.WriteFlags -
Constructor Summary
ConstructorsConstructorDescriptionTypefaceSpan(Typeface typeface) Constructs aTypefaceSpanfrom aTypeface.TypefaceSpan(Parcel src) TypefaceSpan(String family) Constructs aTypefaceSpanbased on the font family. -
Method Summary
Modifier and TypeMethodDescriptionReturns the font family name set in the span.intReturn a special type identifier for this span class.Returns the typeface set in the span.voidupdateMeasureState(TextPaint paint) Classes that extendMetricAffectingSpanimplement this method to update the text formatting in a way that can change the width or height of characters.voidwriteToParcel(Parcel dest, int flags) The subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.Methods inherited from class icyllis.modernui.text.style.MetricAffectingSpan
updateDrawStateMethods inherited from class icyllis.modernui.text.style.CharacterStyle
clone, wrap
-
Constructor Details
-
TypefaceSpan
Constructs aTypefaceSpanbased on the font family. The previous style of the TextPaint is kept. If the font family is null, the text paint is not modified.- Parameters:
family- The font family for this typeface. Examples include "monospace", "serif", and "sans-serif"
-
TypefaceSpan
Constructs aTypefaceSpanfrom aTypeface. The previous style of the TextPaint is overridden and the style of the typeface is used.- Parameters:
typeface- the typeface
-
TypefaceSpan
-
-
Method Details
-
getSpanTypeId
public int getSpanTypeId()Return a special type identifier for this span class.- Specified by:
getSpanTypeIdin interfaceicyllis.modernui.text.ParcelableSpan
-
writeToParcel
Description copied from interface:ParcelableThe subclass implements the method to flatten its contents by calling the methods ofParcelfor its primitive values.- Specified by:
writeToParcelin interfaceParcelable- Parameters:
dest- the parcel to write the object's data toflags- the flags about how the object should be written
-
getFamily
Returns the font family name set in the span.- Returns:
- the font family name
- See Also:
-
getTypeface
Returns the typeface set in the span.- Returns:
- the typeface set
- See Also:
-
updateMeasureState
Description copied from class:MetricAffectingSpanClasses that extendMetricAffectingSpanimplement this method to update the text formatting in a way that can change the width or height of characters.- Specified by:
updateMeasureStatein classMetricAffectingSpan- Parameters:
paint- the paint used for measuring the text
-