1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-16 18:06:55 +00:00

Make the default font size 13 pt to match a recent Twitch change

This commit is contained in:
Theodore Dubois 2020-10-04 16:29:36 -07:00
parent 64f7a513a8
commit cf97620c7f
4 changed files with 15 additions and 11 deletions

View file

@ -9,6 +9,7 @@ import dayjs from 'dayjs';
import Module from 'utilities/module'; import Module from 'utilities/module';
import {createElement, ManagedStyle} from 'utilities/dom'; import {createElement, ManagedStyle} from 'utilities/dom';
import {timeout, has, glob_to_regex, escape_regex, split_chars} from 'utilities/object'; import {timeout, has, glob_to_regex, escape_regex, split_chars} from 'utilities/object';
import {CHAT_FONT_SIZE} from 'utilities/constants';
import Badges from './badges'; import Badges from './badges';
import Emotes from './emotes'; import Emotes from './emotes';
@ -100,7 +101,7 @@ export default class Chat extends Module {
}); });
this.settings.add('chat.font-size', { this.settings.add('chat.font-size', {
default: 12, default: CHAT_FONT_SIZE,
ui: { ui: {
path: 'Chat > Appearance >> General', path: 'Chat > Appearance >> General',
title: 'Font Size', title: 'Font Size',
@ -109,7 +110,7 @@ export default class Chat extends Module {
process(val) { process(val) {
val = parseInt(val, 10); val = parseInt(val, 10);
if ( isNaN(val) || ! isFinite(val) || val <= 0 ) if ( isNaN(val) || ! isFinite(val) || val <= 0 )
return 12; return null;
return val; return val;
} }

View file

@ -7,6 +7,7 @@
import {get} from 'utilities/object'; import {get} from 'utilities/object';
import {ColorAdjuster} from 'utilities/color'; import {ColorAdjuster} from 'utilities/color';
import {CHAT_FONT_SIZE} from 'utilities/constants';
import Module from 'utilities/module'; import Module from 'utilities/module';
import Line from './line'; import Line from './line';
@ -66,7 +67,7 @@ export default class Chat extends Module {
updateChatCSS() { updateChatCSS() {
const size = this.chat.context.get('chat.font-size'), const size = this.chat.context.get('chat.font-size'),
emote_alignment = this.chat.context.get('chat.lines.emote-alignment'), emote_alignment = this.chat.context.get('chat.lines.emote-alignment'),
lh = Math.round((20/12) * size); lh = Math.round((20/CHAT_FONT_SIZE) * size);
let font = this.chat.context.get('chat.font-family') || 'inherit'; let font = this.chat.context.get('chat.font-family') || 'inherit';
if ( font.indexOf(' ') !== -1 && font.indexOf(',') === -1 && font.indexOf('"') === -1 && font.indexOf("'") === -1 ) if ( font.indexOf(' ') !== -1 && font.indexOf(',') === -1 && font.indexOf('"') === -1 && font.indexOf("'") === -1 )
@ -76,7 +77,7 @@ export default class Chat extends Module {
this.css_tweaks.setVariable('chat-line-height', `${lh/10}rem`); this.css_tweaks.setVariable('chat-line-height', `${lh/10}rem`);
this.css_tweaks.setVariable('chat-font-family', font); this.css_tweaks.setVariable('chat-font-family', font);
this.css_tweaks.toggle('chat-font', size !== 12 || font); this.css_tweaks.toggle('chat-font', size !== CHAT_FONT_SIZE || font);
this.css_tweaks.toggle('emote-alignment-padded', emote_alignment === 1); this.css_tweaks.toggle('emote-alignment-padded', emote_alignment === 1);
this.css_tweaks.toggle('emote-alignment-baseline', emote_alignment === 2); this.css_tweaks.toggle('emote-alignment-baseline', emote_alignment === 2);

View file

@ -6,7 +6,7 @@
import {ColorAdjuster} from 'utilities/color'; import {ColorAdjuster} from 'utilities/color';
import {get, has, make_enum, shallow_object_equals, set_equals, deep_equals} from 'utilities/object'; import {get, has, make_enum, shallow_object_equals, set_equals, deep_equals} from 'utilities/object';
import {WEBKIT_CSS as WEBKIT} from 'utilities/constants'; import {WEBKIT_CSS as WEBKIT, CHAT_FONT_SIZE} from 'utilities/constants';
import {FFZEvent} from 'utilities/events'; import {FFZEvent} from 'utilities/events';
import Module from 'utilities/module'; import Module from 'utilities/module';
@ -619,7 +619,7 @@ export default class ChatHook extends Module {
const width = this.chat.context.get('chat.width'), const width = this.chat.context.get('chat.width'),
size = this.chat.context.get('chat.font-size'), size = this.chat.context.get('chat.font-size'),
emote_alignment = this.chat.context.get('chat.lines.emote-alignment'), emote_alignment = this.chat.context.get('chat.lines.emote-alignment'),
lh = Math.round((20/12) * size); lh = Math.round((20/CHAT_FONT_SIZE) * size);
let font = this.chat.context.get('chat.font-family') || 'inherit'; let font = this.chat.context.get('chat.font-family') || 'inherit';
if ( font.indexOf(' ') !== -1 && font.indexOf(',') === -1 && font.indexOf('"') === -1 && font.indexOf("'") === -1 ) if ( font.indexOf(' ') !== -1 && font.indexOf(',') === -1 && font.indexOf('"') === -1 && font.indexOf("'") === -1 )
@ -631,7 +631,7 @@ export default class ChatHook extends Module {
this.css_tweaks.setVariable('chat-width', `${width/10}rem`); this.css_tweaks.setVariable('chat-width', `${width/10}rem`);
this.css_tweaks.setVariable('negative-chat-width', `${-width/10}rem`); this.css_tweaks.setVariable('negative-chat-width', `${-width/10}rem`);
this.css_tweaks.toggle('chat-font', size !== 12 || font !== 'inherit'); this.css_tweaks.toggle('chat-font', size !== CHAT_FONT_SIZE || font !== 'inherit');
this.css_tweaks.toggle('chat-width', this.settings.get('chat.use-width')); this.css_tweaks.toggle('chat-width', this.settings.get('chat.use-width'));
this.css_tweaks.toggle('emote-alignment-padded', emote_alignment === 1); this.css_tweaks.toggle('emote-alignment-padded', emote_alignment === 1);

View file

@ -125,3 +125,5 @@ export const EmoteTypes = make_enum(
'Global', 'Global',
'TwoFactor' 'TwoFactor'
); );
export const CHAT_FONT_SIZE = 13;