mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-06-03 15:14:18 +00:00
Simplify manual kerning logic.
This commit is contained in:
@@ -27,7 +27,6 @@ class GlyphContext {
|
||||
private static final String FONT_WEIGHT = "fontWeight";
|
||||
private static final String FONT_FAMILY = "fontFamily";
|
||||
private static final String LETTER_SPACING = "letterSpacing";
|
||||
private static final String IS_KERNING_VALUE_SET = "isKerningValueSet";
|
||||
|
||||
// Unique input attribute lists (only added if node sets a value)
|
||||
private final ArrayList<String[]> mXsContext = new ArrayList<>();
|
||||
@@ -355,7 +354,6 @@ class GlyphContext {
|
||||
|
||||
ReadableMap getFont() {
|
||||
WritableMap map = Arguments.createMap();
|
||||
map.putBoolean(IS_KERNING_VALUE_SET, false);
|
||||
map.putDouble(FONT_SIZE, fontSize);
|
||||
|
||||
boolean letterSpacingSet = false;
|
||||
@@ -395,7 +393,6 @@ class GlyphContext {
|
||||
if (!kerningSet && font.hasKey(KERNING)) {
|
||||
String kerningString = font.getString(KERNING);
|
||||
float kerning = Float.valueOf(kerningString);
|
||||
map.putBoolean(IS_KERNING_VALUE_SET, true);
|
||||
map.putDouble(KERNING, kerning);
|
||||
kerningSet = true;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ class TSpanShadowNode extends TextShadowNode {
|
||||
private static final String PROP_FONT_WEIGHT = "fontWeight";
|
||||
private static final String PROP_FONT_FAMILY = "fontFamily";
|
||||
private static final String PROP_LETTER_SPACING = "letterSpacing";
|
||||
private static final String PROP_IS_KERNING_VALUE_SET = "isKerningValueSet";
|
||||
|
||||
private Path mCache;
|
||||
private @Nullable String mContent;
|
||||
@@ -161,7 +160,7 @@ class TSpanShadowNode extends TextShadowNode {
|
||||
|
||||
boolean autoKerning = true;
|
||||
float kerning = DEFAULT_KERNING;
|
||||
if (font.getBoolean(PROP_IS_KERNING_VALUE_SET)) {
|
||||
if (font.hasKey(PROP_KERNING)) {
|
||||
kerning = (float) (font.getDouble(PROP_KERNING) * mScale);
|
||||
autoKerning = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user