Skip to content

Commit a83a60b

Browse files
ontzicacoates-ms
authored andcommitted
Reverting ISS/react-native PR #114011 (react#163)
1 parent 690168f commit a83a60b

5 files changed

Lines changed: 3 additions & 56 deletions

File tree

Libraries/Text/TextStylePropTypes.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ const TextStylePropTypes = {
1919

2020
color: DeprecatedColorPropType,
2121
fontFamily: ReactPropTypes.string,
22-
/**
23-
* Specifies the fully qualified path of the font file.
24-
* @platform android
25-
*/
26-
fontPath: ReactPropTypes.string, // TODO(android ISS)
2722
fontSize: ReactPropTypes.number,
2823
fontStyle: ReactPropTypes.oneOf(['normal', 'italic']),
2924
/**

ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewProps.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public class ViewProps {
8686
public static final String FONT_WEIGHT = "fontWeight";
8787
public static final String FONT_STYLE = "fontStyle";
8888
public static final String FONT_FAMILY = "fontFamily";
89-
public static final String FONT_PATH = "fontPath";
9089
public static final String LINE_HEIGHT = "lineHeight";
9190
public static final String LETTER_SPACING = "letterSpacing";
9291
public static final String NEEDS_OFFSCREEN_ALPHA_COMPOSITING = "needsOffscreenAlphaCompositing";

ReactAndroid/src/main/java/com/facebook/react/views/text/CustomStyleSpan.java

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/**
32
* Copyright (c) Facebook, Inc. and its affiliates.
43
*
@@ -36,20 +35,6 @@ public class CustomStyleSpan extends MetricAffectingSpan implements ReactSpan {
3635
private final int mStyle;
3736
private final int mWeight;
3837
private final @Nullable String mFontFamily;
39-
private final @Nullable String mFontPath;
40-
41-
public CustomStyleSpan(
42-
int fontStyle,
43-
int fontWeight,
44-
@Nullable String fontFamily,
45-
@Nullable String fontPath,
46-
AssetManager assetManager) {
47-
mStyle = fontStyle;
48-
mWeight = fontWeight;
49-
mFontFamily = fontFamily;
50-
mFontPath = fontPath;
51-
mAssetManager = assetManager;
52-
}
5338

5439
public CustomStyleSpan(
5540
int fontStyle,
@@ -59,18 +44,17 @@ public CustomStyleSpan(
5944
mStyle = fontStyle;
6045
mWeight = fontWeight;
6146
mFontFamily = fontFamily;
62-
mFontPath = null;
6347
mAssetManager = assetManager;
6448
}
6549

6650
@Override
6751
public void updateDrawState(TextPaint ds) {
68-
apply(ds, mStyle, mWeight, mFontFamily, mFontPath, mAssetManager);
52+
apply(ds, mStyle, mWeight, mFontFamily, mAssetManager);
6953
}
7054

7155
@Override
7256
public void updateMeasureState(@NonNull TextPaint paint) {
73-
apply(paint, mStyle, mWeight, mFontFamily, mFontPath, mAssetManager);
57+
apply(paint, mStyle, mWeight, mFontFamily, mAssetManager);
7458
}
7559

7660
/**
@@ -94,19 +78,11 @@ public int getWeight() {
9478
return mFontFamily;
9579
}
9680

97-
/**
98-
* Returns the font path set for this StyleSpan.
99-
*/
100-
public @Nullable String getFontPath() {
101-
return mFontPath;
102-
}
103-
10481
private static void apply(
10582
Paint paint,
10683
int style,
10784
int weight,
10885
@Nullable String family,
109-
@Nullable String path,
11086
AssetManager assetManager) {
11187
int oldStyle;
11288
Typeface typeface = paint.getTypeface();

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ private static void buildSpannedFromShadowNode(
179179
}
180180
if (textShadowNode.mFontStyle != UNSET
181181
|| textShadowNode.mFontWeight != UNSET
182-
|| textShadowNode.mFontFamily != null
183-
|| (textShadowNode.mFontPath != null && textShadowNode.mFontFamily != null)) {
182+
|| textShadowNode.mFontFamily != null) {
184183
ops.add(
185184
new SetSpanOperation(
186185
start,
@@ -189,7 +188,6 @@ private static void buildSpannedFromShadowNode(
189188
textShadowNode.mFontStyle,
190189
textShadowNode.mFontWeight,
191190
textShadowNode.mFontFamily,
192-
textShadowNode.mFontPath,
193191
textShadowNode.getThemedContext().getAssets())));
194192
}
195193
if (textShadowNode.mIsUnderlineTextDecorationSet) {
@@ -363,7 +361,6 @@ private static int parseNumericFontWeight(String fontWeightString) {
363361
* <Text style={{fontFamily="serif}}>Bold Text</Text>
364362
*/
365363
protected @Nullable String mFontFamily = null;
366-
protected @Nullable String mFontPath = null;
367364

368365
protected boolean mContainsImages = false;
369366
protected Map<Integer, ReactShadowNode> mInlineViews;
@@ -483,12 +480,6 @@ public void setFontFamily(@Nullable String fontFamily) {
483480
markUpdated();
484481
}
485482

486-
@ReactProp(name = ViewProps.FONT_PATH)
487-
public void setFontPath(@Nullable String fontPath) {
488-
mFontPath = fontPath;
489-
markUpdated();
490-
}
491-
492483
/**
493484
/* This code is duplicated in ReactTextInputManager
494485
/* TODO: Factor into a common place they can both use

ReactAndroid/src/main/java/com/facebook/react/views/text/ReactFontManager.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,6 @@ public void setTypeface(String fontFamilyName, int style, Typeface typeface) {
149149
return Typeface.create(fontFamilyName, style);
150150
}
151151

152-
private static
153-
@Nullable Typeface createTypeface(
154-
String fontPath,
155-
String fontFamilyName,
156-
int style) {
157-
try {
158-
return Typeface.createFromFile(fontPath);
159-
} catch (RuntimeException e) {
160-
// unfortunately Typeface.createFromFile throws an exception instead of returning null
161-
// if the typeface doesn't exist
162-
}
163-
return Typeface.create(fontFamilyName, style);
164-
}
165-
166152
private static class FontFamily {
167153

168154
private SparseArray<Typeface> mTypefaceSparseArray;

0 commit comments

Comments
 (0)