fix indentation errors in fonts.conf file created on apple and android platforms

This commit is contained in:
Taner Sener 2022-08-21 23:40:34 +01:00
parent 7ca081a488
commit 862b0485e0
2 changed files with 19 additions and 19 deletions

View File

@ -430,14 +430,14 @@ public class FFmpegKitConfig {
String mappedFontName = mapping.getValue();
if ((fontName != null) && (mappedFontName != null) && (fontName.trim().length() > 0) && (mappedFontName.trim().length() > 0)) {
fontNameMappingBlock.append(" <match target=\"pattern\">\n");
fontNameMappingBlock.append(" <test qual=\"any\" name=\"family\">\n");
fontNameMappingBlock.append(String.format(" <string>%s</string>\n", fontName));
fontNameMappingBlock.append(" </test>\n");
fontNameMappingBlock.append(" <edit name=\"family\" mode=\"assign\" binding=\"same\">\n");
fontNameMappingBlock.append(String.format(" <string>%s</string>\n", mappedFontName));
fontNameMappingBlock.append(" </edit>\n");
fontNameMappingBlock.append(" </match>\n");
fontNameMappingBlock.append(" <match target=\"pattern\">\n");
fontNameMappingBlock.append(" <test qual=\"any\" name=\"family\">\n");
fontNameMappingBlock.append(String.format(" <string>%s</string>\n", fontName));
fontNameMappingBlock.append(" </test>\n");
fontNameMappingBlock.append(" <edit name=\"family\" mode=\"assign\" binding=\"same\">\n");
fontNameMappingBlock.append(String.format(" <string>%s</string>\n", mappedFontName));
fontNameMappingBlock.append(" </edit>\n");
fontNameMappingBlock.append(" </match>\n");
validFontNameMappingCount++;
}
@ -455,7 +455,7 @@ public class FFmpegKitConfig {
fontConfigBuilder.append("</dir>\n");
}
fontConfigBuilder.append(fontNameMappingBlock);
fontConfigBuilder.append("</fontconfig>");
fontConfigBuilder.append("</fontconfig>\n");
final AtomicReference<FileOutputStream> reference = new AtomicReference<>();
try {

View File

@ -840,14 +840,14 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
if ((fontName != nil) && (mappedFontName != nil) && ([fontName length] > 0) && ([mappedFontName length] > 0)) {
fontNameMappingBlock = [NSString stringWithFormat:@"%@\n%@\n%@%@%@\n%@\n%@\n%@%@%@\n%@\n%@\n",
@" <match target=\"pattern\">",
@" <test qual=\"any\" name=\"family\">",
@" <string>", fontName, @"</string>",
@" </test>",
@" <edit name=\"family\" mode=\"assign\" binding=\"same\">",
@" <string>", mappedFontName, @"</string>",
@" </edit>",
@" </match>"];
@" <match target=\"pattern\">",
@" <test qual=\"any\" name=\"family\">",
@" <string>", fontName, @"</string>",
@" </test>",
@" <edit name=\"family\" mode=\"assign\" binding=\"same\">",
@" <string>", mappedFontName, @"</string>",
@" </edit>",
@" </match>"];
validFontNameMappingCount++;
}
@ -862,10 +862,10 @@ int executeFFprobe(long sessionId, NSArray* arguments) {
NSString *fontDirectoryPath = [fontDirectoryArray objectAtIndex:i];
[fontConfiguration appendString: @" <dir>"];
[fontConfiguration appendString: fontDirectoryPath];
[fontConfiguration appendString: @"</dir>"];
[fontConfiguration appendString: @"</dir>\n"];
}
[fontConfiguration appendString:fontNameMappingBlock];
[fontConfiguration appendString:@"</fontconfig>"];
[fontConfiguration appendString:@"</fontconfig>\n"];
if (![fontConfiguration writeToFile:fontConfigurationFile atomically:YES encoding:NSUTF8StringEncoding error:&error]) {
NSLog(@"Failed to set font directory. Error received while saving font configuration: %@.", error);