Commit 0544e2d4 authored by Winston Weinert's avatar Winston Weinert Committed by Felix Paul Kühne

Allow users to select bold font variants for subtitles.

A Toggle Option is exposed in App setting and Settings.app.
English transation is provided. The main business logic is in
VLCMovieViewController#_resolveFontName, utilizing a NSDictionary
to map regular font names to their bold variants.
Signed-off-by: Felix Paul Kühne's avatarFelix Paul Kühne <fkuehne@videolan.org>
parent 5060134d
......@@ -212,6 +212,16 @@
<string>6</string>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>SETTINGS_SUBTITLES_BOLDFONT</string>
<key>Key</key>
<string>quartztext-bold</string>
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
......
......@@ -202,6 +202,16 @@
<string>6</string>
</array>
</dict>
<dict>
<key>Type</key>
<string>PSToggleSwitchSpecifier</string>
<key>Title</key>
<string>SETTINGS_SUBTITLES_BOLDFONT</string>
<key>Key</key>
<string>quartztext-bold</string>
<key>DefaultValue</key>
<false/>
</dict>
<dict>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
......
B/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */
......
......@@ -53,7 +53,7 @@
else
skipLoopFilterDefaultValue = kVLCSettingSkipLoopFilterNonRef;
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES]};
NSDictionary *appDefaults = @{kVLCSettingPasscodeKey : @"", kVLCSettingPasscodeOnKey : @(NO), kVLCSettingContinueAudioInBackgroundKey : @(YES), kVLCSettingStretchAudio : @(NO), kVLCSettingTextEncoding : kVLCSettingTextEncodingDefaultValue, kVLCSettingSkipLoopFilter : skipLoopFilterDefaultValue, kVLCSettingSubtitlesFont : kVLCSettingSubtitlesFontDefaultValue, kVLCSettingSubtitlesFontColor : kVLCSettingSubtitlesFontColorDefaultValue, kVLCSettingSubtitlesFontSize : kVLCSettingSubtitlesFontSizeDefaultValue, kVLCSettingSubtitlesBoldFont: kVLCSettingSubtitlesBoldFontDefaulValue, kVLCSettingDeinterlace : kVLCSettingDeinterlaceDefaultValue, kVLCSettingNetworkCaching : kVLCSettingNetworkCachingDefaultValue, kVLCSettingPlaybackGestures : [NSNumber numberWithBool:YES]};
[defaults registerDefaults:appDefaults];
}
......
......@@ -30,6 +30,8 @@
#define kVLCSettingSubtitlesFontDefaultValue @"HelveticaNeue"
#define kVLCSettingSubtitlesFontSize @"quartztext-rel-fontsize"
#define kVLCSettingSubtitlesFontSizeDefaultValue @"16"
#define kVLCSettingSubtitlesBoldFont @"quartztext-bold"
#define kVLCSettingSubtitlesBoldFontDefaulValue @NO
#define kVLCSettingSubtitlesFontColor @"quartztext-color"
#define kVLCSettingSubtitlesFontColorDefaultValue @"16777215"
#define kVLCSettingDeinterlace @"deinterlace"
......
......@@ -405,7 +405,8 @@
return;
}
_listPlayer = [[VLCMediaListPlayer alloc] initWithOptions:@[[NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFont, [defaults objectForKey:kVLCSettingSubtitlesFont]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFontColor, [defaults objectForKey:kVLCSettingSubtitlesFontColor]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFontSize, [defaults objectForKey:kVLCSettingSubtitlesFontSize]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingDeinterlace, [defaults objectForKey:kVLCSettingDeinterlace]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingNetworkCaching, [defaults objectForKey:kVLCSettingNetworkCaching]]]];
_listPlayer = [[VLCMediaListPlayer alloc]
initWithOptions:@[[NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFont, [self _resolveFontName]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFontColor, [defaults objectForKey:kVLCSettingSubtitlesFontColor]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingSubtitlesFontSize, [defaults objectForKey:kVLCSettingSubtitlesFontSize]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingDeinterlace, [defaults objectForKey:kVLCSettingDeinterlace]], [NSString stringWithFormat:@"--%@=%@", kVLCSettingNetworkCaching, [defaults objectForKey:kVLCSettingNetworkCaching]]]];
_mediaPlayer = _listPlayer.mediaPlayer;
[_mediaPlayer setDelegate:self];
[_mediaPlayer setDrawable:self.movieView];
......@@ -637,6 +638,45 @@
}
}
- (NSString *)_resolveFontName
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
BOOL bold = [[defaults objectForKey:kVLCSettingSubtitlesBoldFont] boolValue];
NSString *font = [defaults objectForKey:kVLCSettingSubtitlesFont];
NSDictionary *fontMap = @{
@"AmericanTypewriter": @"AmericanTypewriter-Bold",
@"ArialMT": @"Arial-BoldMT",
@"ArialHebrew": @"ArialHebrew-Bold",
@"ChalkboardSE-Regular": @"ChalkboardSE-Bold",
@"CourierNewPSMT": @"CourierNewPS-BoldMT",
@"Georgia": @"Georgia-Bold",
@"GillSans": @"GillSans-Bold",
@"GujaratiSangamMN": @"GujaratiSangamMN-Bold",
@"STHeitiSC-Light": @"STHeitiSC-Medium",
@"STHeitiTC-Light": @"STHeitiTC-Medium",
@"HelveticaNeue": @"HelveticaNeue-Bold",
@"HiraKakuProN-W3": @"HiraKakuProN-W6",
@"HiraMinProN-W3": @"HiraMinProN-W6",
@"HoeflerText-Regular": @"HoeflerText-Black",
@"Kailasa": @"Kailasa-Bold",
@"KannadaSangamMN": @"KannadaSangamMN-Bold",
@"MalayalamSangamMN": @"MalayalamSangamMN-Bold",
@"OriyaSangamMN": @"OriyaSangamMN-Bold",
@"SinhalaSangamMN": @"SinhalaSangamMN-Bold",
@"SnellRoundhand": @"SnellRoundhand-Bold",
@"TamilSangamMN": @"TamilSangamMN-Bold",
@"TeluguSangamMN": @"TeluguSangamMN-Bold",
@"TimesNewRomanPSMT": @"TimesNewRomanPS-BoldMT",
@"Zapfino": @"Zapfino"
};
if (!bold) {
return font;
} else {
return fontMap[font];
}
}
#pragma mark - remote events
- (void)viewDidAppear:(BOOL)animated
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment