Skip to content

Commit

Permalink
Cyrillic support (#108)
Browse files Browse the repository at this point in the history
* Xcode 9.4.1 Update to Recommended Settings

* Fix 18 Analyze warnings in MTMathAtomFactory.m+.h

* Fix 4 Analyze warnings in MTFont.m

* Fix 3 yellow warnings in MTTypesetter.m

* Fix 2 'Assigned value is garbage or undefined' Analyze issues

* Fix 1 Analyze warning in MTFontMathTable.m

* Fix 'colorWithRed:green:blue:alpha: is only available on macOS 10.9' yellow warning

* added basic cyrillic symbols support
  • Loading branch information
kateryna-rotpanda authored and kostub committed Dec 3, 2018
1 parent 87634b4 commit ad2c515
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
14 changes: 11 additions & 3 deletions iosMath.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-iosMathTests/Pods-iosMathTests-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/iosMath-iOS6.0/mathFonts.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/iosMath-iOS6.0/mathFonts.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
Expand Down Expand Up @@ -822,11 +822,15 @@
isa = XCBuildConfiguration;
baseConfigurationReference = D93290960585498BBAEE4535 /* Pods-iosMathExample.debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T984FR9Q54;
INFOPLIST_FILE = "iosMathExample/iosMath-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
PRODUCT_BUNDLE_IDENTIFIER = MathChat.iosMathExample;
PRODUCT_BUNDLE_IDENTIFIER = rotpanda.MathChat.iosMathExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -835,11 +839,15 @@
isa = XCBuildConfiguration;
baseConfigurationReference = B16B9A63054AE3FFB5C36F6B /* Pods-iosMathExample.release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = T984FR9Q54;
INFOPLIST_FILE = "iosMathExample/iosMath-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
PRODUCT_BUNDLE_IDENTIFIER = MathChat.iosMathExample;
PRODUCT_BUNDLE_IDENTIFIER = rotpanda.MathChat.iosMathExample;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "";
PROVISIONING_PROFILE_SPECIFIER = "";
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
5 changes: 4 additions & 1 deletion iosMath/lib/MTMathAtomFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ + (MTLargeOperator *)operatorWithName:(NSString *)name limits:(bool) limits
+ (nullable MTMathAtom *)atomForCharacter:(unichar)ch
{
NSString *chStr = [NSString stringWithCharacters:&ch length:1];
if (ch < 0x21 || ch > 0x7E) {
if (ch > 0x0410 && ch < 0x044F){
// show basic cyrillic alphabet. Latin Modern Math font is not good for cyrillic symbols
return [MTMathAtom atomWithType:kMTMathAtomOrdinary value:chStr];
} else if (ch < 0x21 || ch > 0x7E) {
// skip non ascii characters and spaces
return nil;
} else if (ch == '$' || ch == '%' || ch == '#' || ch == '&' || ch == '~' || ch == '\'') {
Expand Down
2 changes: 1 addition & 1 deletion iosMathExample/example/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ - (void)viewDidLoad

// Demo formulae
// Quadratic formula
self.demoLabels[0] = [self createMathLabel:@"x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}" withHeight:60];
self.demoLabels[0] = [self createMathLabel:@"\\text{ваш вопрос: }x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}" withHeight:60];
[self addLabelAsSubview:self.demoLabels[0] to:contentView];
self.demoLabels[0].fontSize = 15;
// This is first label so set the height from the top
Expand Down

0 comments on commit ad2c515

Please sign in to comment.