[vlc-commits] macosx: Fix default font in extensions UI
Marvin Scholz
git at videolan.org
Fri Feb 16 19:57:59 CET 2018
vlc | branch: master | Marvin Scholz <epirat07 at gmail.com> | Fri Feb 16 19:57:45 2018 +0100| [222bc139ad6c92dda41aee35a5aa0a53b3d1d200] | committer: Marvin Scholz
macosx: Fix default font in extensions UI
Default to the system font for extension textfields, labels and
webviews.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=222bc139ad6c92dda41aee35a5aa0a53b3d1d200
---
modules/gui/macosx/VLCExtensionsDialogProvider.m | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/modules/gui/macosx/VLCExtensionsDialogProvider.m b/modules/gui/macosx/VLCExtensionsDialogProvider.m
index ebcf989f29..5a79256bbb 100644
--- a/modules/gui/macosx/VLCExtensionsDialogProvider.m
+++ b/modules/gui/macosx/VLCExtensionsDialogProvider.m
@@ -150,13 +150,16 @@ static NSView *createControlFromWidget(extension_widget_t *widget, id self)
static void updateControlFromWidget(NSView *control, extension_widget_t *widget, id self)
{
@autoreleasepool {
+ NSString * const defaultStyleCSS = @"<style>*{ font-family: \
+ -apple-system-body, -apple-system, \
+ HelveticaNeue, Arial, sans-serif; }</style>";
switch (widget->type) {
case EXTENSION_WIDGET_HTML:
{
// Get the web view
assert([control isKindOfClass:[WebView class]]);
WebView *webView = (WebView *)control;
- NSString *string = toNSStr(widget->psz_text);
+ NSString *string = [defaultStyleCSS stringByAppendingString:toNSStr(widget->psz_text)];
[[webView mainFrame] loadHTMLString:string baseURL:[NSURL URLWithString:@""]];
[webView setNeedsDisplay:YES];
break;
@@ -169,7 +172,7 @@ static void updateControlFromWidget(NSView *control, extension_widget_t *widget,
break;
assert([control isKindOfClass:[NSControl class]]);
NSControl *field = (NSControl *)control;
- NSString *string = toNSStr(widget->psz_text);
+ NSString *string = [defaultStyleCSS stringByAppendingString:toNSStr(widget->psz_text)];
NSAttributedString *attrString = [[NSAttributedString alloc] initWithHTML:[string dataUsingEncoding: NSISOLatin1StringEncoding] documentAttributes:NULL];
[field setAttributedStringValue:attrString];
break;
More information about the vlc-commits
mailing list