Skip to content

Commit 6b17f59

Browse files
committed
Fontello font support.
Also fix bb codes regular expressions.
1 parent c0d18f9 commit 6b17f59

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

App/Fonts/fontello.ttf

27.9 KB
Binary file not shown.

App/Info.plist

+4
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
</array>
2323
<key>ITSAppUsesNonExemptEncryption</key>
2424
<false/>
25+
<key>UIAppFonts</key>
26+
<array>
27+
<string>fontello.ttf</string>
28+
</array>
2529
<key>UIApplicationSceneManifest</key>
2630
<dict>
2731
<key>UIApplicationSupportsMultipleScenes</key>

ForPDA.xcodeproj/project.pbxproj

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 56;
6+
objectVersion = 70;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -60,6 +60,10 @@
6060
B8DEB2212BAB81CC00AD97C6 /* App.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = App.swift; sourceTree = "<group>"; };
6161
/* End PBXFileReference section */
6262

63+
/* Begin PBXFileSystemSynchronizedRootGroup section */
64+
13C9F9FA2CADCDFF003280F3 /* Fonts */ = {isa = PBXFileSystemSynchronizedRootGroup; explicitFileTypes = {}; explicitFolders = (); path = Fonts; sourceTree = "<group>"; };
65+
/* End PBXFileSystemSynchronizedRootGroup section */
66+
6367
/* Begin PBXFrameworksBuildPhase section */
6468
B8AB63BA2AA49F6100F2CEFF /* Frameworks */ = {
6569
isa = PBXFrameworksBuildPhase;
@@ -123,6 +127,7 @@
123127
B8D351F7293CABB6008A84EA /* App */ = {
124128
isa = PBXGroup;
125129
children = (
130+
13C9F9FA2CADCDFF003280F3 /* Fonts */,
126131
B8DEB2212BAB81CC00AD97C6 /* App.swift */,
127132
B88BDA872BF6BC0200E17268 /* Assets.xcassets */,
128133
B84BC1E42C77DA4000C38BB2 /* LaunchScreen.storyboard */,
@@ -173,6 +178,9 @@
173178
dependencies = (
174179
B8AB63D42AA49F6100F2CEFF /* PBXTargetDependency */,
175180
);
181+
fileSystemSynchronizedGroups = (
182+
13C9F9FA2CADCDFF003280F3 /* Fonts */,
183+
);
176184
name = ForPDA;
177185
packageProductDependencies = (
178186
B894CE152C7FB54700D0D18B /* AppFeature */,

Packages/Sources/ParsingClient/Parsers/BBCodeParser.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ public final class BBCodeParser {
1919
text = text.replacingOccurrences(of: "\\[i\\](.*?)\\[\\/i\\]", with: "<i>$1</i>", options: .regularExpression) // Italic
2020
text = text.replacingOccurrences(of: "\\[s\\](.*?)\\[\\/s\\]", with: "<s>$1</s>", options: .regularExpression) // Strikethrough
2121
text = text.replacingOccurrences(of: "\\[u\\](.*?)\\[\\/u\\]", with: "<u>$1</u>", options: .regularExpression) // Underline
22-
text = text.replacingOccurrences(of: "\\[color=(.*?)\\](.*?)\\[\\/color\\]", with: "<font color=\"$1\">$2</font>", options: .regularExpression) // Text color
23-
text = text.replacingOccurrences(of: "\\[size=(.*?)\\](.*?)\\[\\/size\\]", with: "<span style=\"font-size:$1\">$2</span>", options: .regularExpression) // Text size
24-
text = text.replacingOccurrences(of: "\\[background=(.*?)\\](.*?)\\[\\/background\\]", with: "<span style=\"background-color:$1\">$2</span>", options: .regularExpression) // Text background
25-
text = text.replacingOccurrences(of: "\\[font=\"(.*?)\"\\](.*?)\\[\\/font\\]", with: "<span style=\"font-family:$1\">$2</span>", options: .regularExpression) // Text font
22+
text = text.replacingOccurrences(of: "\\[color=\"?(.*?)\"?\\](.*?)\\[\\/color\\]", with: "<font color=\"$1\">$2</font>", options: .regularExpression) // Text color
23+
text = text.replacingOccurrences(of: "\\[size=\"?(.*?)\"?\\](.*?)\\[\\/size\\]", with: "<span style=\"font-size:$1\">$2</span>", options: .regularExpression) // Text size
24+
text = text.replacingOccurrences(of: "\\[background=\"?(.*?)\"?\\](.*?)\\[\\/background\\]", with: "<span style=\"background-color:$1\">$2</span>", options: .regularExpression) // Text background
25+
text = text.replacingOccurrences(of: "\\[font=\"?(.*?)\"?\\](.*?)\\[\\/font\\]", with: "<span style=\"font-family:$1\">$2</span>", options: .regularExpression) // Text font
2626
text = text.replacingOccurrences(of: "\\[url\\](.*?)\\[\\/url\\]", with: "<a href=\"$1\">$1</a>", options: .regularExpression) // URL links without text
27-
text = text.replacingOccurrences(of: "\\[url=\"(.*?)\"\\](.*?)\\[\\/url\\]", with: "<a href=\"$1\">$2</a>", options: .regularExpression) // URL links with text
27+
text = text.replacingOccurrences(of: "\\[url=\"?(.*?)\"?\\](.*?)\\[\\/url\\]", with: "<a href=\"$1\">$2</a>", options: .regularExpression) // URL links with text
2828

2929
let parser = ZHTMLParserBuilder.initWithDefault()
3030
.set(rootStyle: MarkupStyle(font: MarkupStyleFont(.preferredFont(forTextStyle: fontStyle))))

0 commit comments

Comments
 (0)