Skip to content

Commit

Permalink
fix: add the new font-family
Browse files Browse the repository at this point in the history
  • Loading branch information
0xthierry committed Apr 30, 2021
1 parent 2ae23e7 commit c826d47
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 6 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added assets/fonts/GTAmericaExpMono-Bd.otf
Binary file not shown.
Binary file added assets/fonts/GTAmericaExpMono-BdIt.otf
Binary file not shown.
Binary file added assets/fonts/GTAmericaExpMono-RgIt.otf
Binary file not shown.
12 changes: 12 additions & 0 deletions ios/ExpensifyCash.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
8C86654500DCC843A74147B5 /* libPods-ExpensifyCash-ExpensifyCashTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ED2AB27DDDFCCE3CD100EA0C /* libPods-ExpensifyCash-ExpensifyCashTests.a */; };
BB6CECBDA023256B6B955321 /* libPods-ExpensifyCash.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F2C8BDCC1FF0B64AE2DFC9B /* libPods-ExpensifyCash.a */; };
E9DF872D2525201700607FDC /* AirshipConfig.plist in Resources */ = {isa = PBXBuildFile; fileRef = E9DF872C2525201700607FDC /* AirshipConfig.plist */; };
52477A09739546F4814EA25F /* GTAmericaExpMono-Bd.otf in Resources */ = {isa = PBXBuildFile; fileRef = 0DE5D096095C41EE96746C9E /* GTAmericaExpMono-Bd.otf */; };
ED814D34526B415CAFA0451E /* GTAmericaExpMono-BdIt.otf in Resources */ = {isa = PBXBuildFile; fileRef = 3981452A2C7340EBBA2B9BD1 /* GTAmericaExpMono-BdIt.otf */; };
DB77016704074197AB6633BB /* GTAmericaExpMono-RgIt.otf in Resources */ = {isa = PBXBuildFile; fileRef = 5150E5D0D7F74DBA8D7C1914 /* GTAmericaExpMono-RgIt.otf */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -70,6 +73,9 @@
ED2971642150620600B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS12.0.sdk/System/Library/Frameworks/JavaScriptCore.framework; sourceTree = DEVELOPER_DIR; };
ED2AB27DDDFCCE3CD100EA0C /* libPods-ExpensifyCash-ExpensifyCashTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ExpensifyCash-ExpensifyCashTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F4BC0E78FF1E9BD8B2D38C66 /* Pods-ExpensifyCash.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ExpensifyCash.debug.xcconfig"; path = "Target Support Files/Pods-ExpensifyCash/Pods-ExpensifyCash.debug.xcconfig"; sourceTree = "<group>"; };
0DE5D096095C41EE96746C9E /* GTAmericaExpMono-Bd.otf */ = {isa = PBXFileReference; name = "GTAmericaExpMono-Bd.otf"; path = "../assets/fonts/GTAmericaExpMono-Bd.otf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
3981452A2C7340EBBA2B9BD1 /* GTAmericaExpMono-BdIt.otf */ = {isa = PBXFileReference; name = "GTAmericaExpMono-BdIt.otf"; path = "../assets/fonts/GTAmericaExpMono-BdIt.otf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
5150E5D0D7F74DBA8D7C1914 /* GTAmericaExpMono-RgIt.otf */ = {isa = PBXFileReference; name = "GTAmericaExpMono-RgIt.otf"; path = "../assets/fonts/GTAmericaExpMono-RgIt.otf"; sourceTree = "<group>"; fileEncoding = undefined; lastKnownFileType = unknown; explicitFileType = undefined; includeInIndex = 0; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -181,6 +187,9 @@
A8D6F2F722FD4E66A38EBBB6 /* GTAmericaExp-BdIt.otf */,
DB5A1365442D4419AF6F08E5 /* GTAmericaExp-MdIt.otf */,
918D7FEFF96242E6B5F5E14D /* GTAmericaExp-RgIt.otf */,
0DE5D096095C41EE96746C9E /* GTAmericaExpMono-Bd.otf */,
3981452A2C7340EBBA2B9BD1 /* GTAmericaExpMono-BdIt.otf */,
5150E5D0D7F74DBA8D7C1914 /* GTAmericaExpMono-RgIt.otf */,
);
name = Resources;
sourceTree = "<group>";
Expand Down Expand Up @@ -307,6 +316,9 @@
6856B78873B64C44A92E51DB /* GTAmericaExp-MdIt.otf in Resources */,
8821A238A081483FA947BC4E /* GTAmericaExp-RgIt.otf in Resources */,
70CF6E82262E297300711ADC /* BootSplash.storyboard in Resources */,
52477A09739546F4814EA25F /* GTAmericaExpMono-Bd.otf in Resources */,
ED814D34526B415CAFA0451E /* GTAmericaExpMono-BdIt.otf in Resources */,
DB77016704074197AB6633BB /* GTAmericaExpMono-RgIt.otf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
5 changes: 4 additions & 1 deletion ios/ExpensifyCash/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<key>NSCameraUsageDescription</key>
<string>Your camera is used to create chat attachments.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<string/>
<key>NSPhotoLibraryAddUsageDescription</key>
<string>Your camera roll is used to store chat attachments.</string>
<key>NSPhotoLibraryUsageDescription</key>
Expand All @@ -82,6 +82,9 @@
<string>GTAmericaExp-BdIt.otf</string>
<string>GTAmericaExp-MdIt.otf</string>
<string>GTAmericaExp-RgIt.otf</string>
<string>GTAmericaExpMono-Bd.otf</string>
<string>GTAmericaExpMono-BdIt.otf</string>
<string>GTAmericaExpMono-RgIt.otf</string>
</array>
<key>UIBackgroundModes</key>
<array>
Expand Down
18 changes: 17 additions & 1 deletion src/components/RenderHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ const EXTRA_FONTS = [
fontFamily.GTA_BOLD,
fontFamily.GTA_ITALIC,
fontFamily.MONOSPACE,
fontFamily.MONOSPACE_ITALIC,
fontFamily.MONOSPACE_BOLD,
fontFamily.MONOSPACE_BOLD_ITALIC,
fontFamily.SYSTEM,
];

Expand Down Expand Up @@ -65,11 +68,24 @@ function CodeRenderer({
// We split wrapper and inner styles
// "boxModelStyle" corresponds to border, margin, padding and backgroundColor
const {boxModelStyle, otherStyle: textStyle} = splitBoxModelStyle(style);

const italic = textStyle.fontStyle === 'italic' && fontFamily.MONOSPACE_ITALIC;
const bold = textStyle.fontWeight === 'bold' && fontFamily.MONOSPACE_BOLD;
const italicBold = italic && bold && fontFamily.MONOSPACE_BOLD_ITALIC;

const font = italicBold || bold || italic || fontFamily.MONOSPACE;

const textStyleOverride = {
fontFamily: font,
fontWeight: undefined,
fontStyle: undefined,
};

return (
<InlineCodeBlock
TDefaultRenderer={TDefaultRenderer}
boxModelStyle={boxModelStyle}
textStyle={textStyle}
textStyle={{...textStyle, ...textStyleOverride}}
defaultRendererProps={defaultRendererProps}
key={key}
/>
Expand Down
5 changes: 4 additions & 1 deletion src/styles/fontFamily/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ const fontFamily = {
GTA_ITALIC: 'GTAmericaExp-RgIt',
GTA_BOLD: bold,
GTA: 'GTAmericaExp-Regular',
MONOSPACE: 'GTAmericaExpMono-Rg',
SYSTEM: 'System',
MONOSPACE: 'GTAmericaExpMono-Rg',
MONOSPACE_ITALIC: 'GTAmericaExpMono-RgIt',
MONOSPACE_BOLD: 'GTAmericaExpMono-Bd',
MONOSPACE_BOLD_ITALIC: 'GTAmericaExpMono-BdIt',
};

export default fontFamily;
5 changes: 2 additions & 3 deletions src/styles/styles.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import fontFamily from './fontFamily';
import italic from './italic';
import addOutlineWidth from './addOutlineWidth';
import themeColors from './themes/default';
import fontWeightBold from './fontWeight/bold';
Expand Down Expand Up @@ -1408,7 +1407,7 @@ const webViewStyles = {
tagStyles: {
em: {
fontFamily: fontFamily.GTA_ITALIC,
fontStyle: italic,
fontStyle: 'italic',
},

del: {
Expand All @@ -1418,7 +1417,7 @@ const webViewStyles = {

strong: {
fontFamily: fontFamily.GTA_BOLD,
fontWeight: fontWeightBold,
fontWeight: 'bold',
},

a: styles.link,
Expand Down

0 comments on commit c826d47

Please sign in to comment.