Fix subtitle line spacing

This commit is contained in:
Dmitry Lyzo 2020-06-14 23:37:48 +03:00
parent df0f266ef0
commit 9e92bfaae7
3 changed files with 30 additions and 49 deletions

View File

@ -1,55 +1,30 @@
define([], function () { define([], function () {
'use strict'; 'use strict';
function getTextStyles(settings, isCue) { function getTextStyles(settings) {
var list = []; var list = [];
if (isCue) { switch (settings.textSize || '') {
switch (settings.textSize || '') { case 'smaller':
list.push({ name: 'font-size', value: '.8em' });
case 'smaller': break;
list.push({ name: 'font-size', value: '.5em' }); case 'small':
break; list.push({ name: 'font-size', value: 'inherit' });
case 'small': break;
list.push({ name: 'font-size', value: '.7em' }); case 'larger':
break; list.push({ name: 'font-size', value: '2em' });
case 'large': break;
list.push({ name: 'font-size', value: '1.3em' }); case 'extralarge':
break; list.push({ name: 'font-size', value: '2.2em' });
case 'larger': break;
list.push({ name: 'font-size', value: '1.72em' }); case 'large':
break; list.push({ name: 'font-size', value: '1.72em' });
case 'extralarge': break;
list.push({ name: 'font-size', value: '2em' }); default:
break; case 'medium':
default: list.push({ name: 'font-size', value: '1.36em' });
case 'medium': break;
break;
}
} else {
switch (settings.textSize || '') {
case 'smaller':
list.push({ name: 'font-size', value: '.8em' });
break;
case 'small':
list.push({ name: 'font-size', value: 'inherit' });
break;
case 'larger':
list.push({ name: 'font-size', value: '2em' });
break;
case 'extralarge':
list.push({ name: 'font-size', value: '2.2em' });
break;
case 'large':
list.push({ name: 'font-size', value: '1.72em' });
break;
default:
case 'medium':
list.push({ name: 'font-size', value: '1.36em' });
break;
}
} }
switch (settings.dropShadow || '') { switch (settings.dropShadow || '') {
@ -122,10 +97,10 @@ define([], function () {
return []; return [];
} }
function getStyles(settings, isCue) { function getStyles(settings) {
return { return {
text: getTextStyles(settings, isCue), text: getTextStyles(settings),
window: getWindowStyles(settings) window: getWindowStyles(settings)
}; };
} }

View File

@ -1178,7 +1178,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
document.getElementsByTagName('head')[0].appendChild(styleElem); document.getElementsByTagName('head')[0].appendChild(styleElem);
} }
styleElem.innerHTML = getCueCss(subtitleAppearanceHelper.getStyles(userSettings.getSubtitleAppearanceSettings(), true), '.htmlvideoplayer'); styleElem.innerHTML = getCueCss(subtitleAppearanceHelper.getStyles(userSettings.getSubtitleAppearanceSettings()), '.htmlvideoplayer');
}); });
} }

View File

@ -33,6 +33,12 @@ video::-webkit-media-controls {
text-shadow: 0.14em 0.14em 0.14em rgba(0, 0, 0, 1); text-shadow: 0.14em 0.14em 0.14em rgba(0, 0, 0, 1);
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
font-family: inherit; font-family: inherit;
line-height: normal; /* Restore value. See -webkit-media-text-track-container 'line-height' */
}
.htmlvideoplayer::-webkit-media-text-track-container {
font-size: 170% !important; /* Override element inline style */
line-height: 50%; /* Child element cannot set line height smaller than its parent has. This allow smaller values for children */
} }
.htmlvideoplayer-moveupsubtitles::-webkit-media-text-track-display { .htmlvideoplayer-moveupsubtitles::-webkit-media-text-track-display {