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,35 +1,11 @@
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: '.5em' });
break;
case 'small':
list.push({ name: 'font-size', value: '.7em' });
break;
case 'large':
list.push({ name: 'font-size', value: '1.3em' });
break;
case 'larger':
list.push({ name: 'font-size', value: '1.72em' });
break;
case 'extralarge':
list.push({ name: 'font-size', value: '2em' });
break;
default:
case 'medium':
break;
}
} else {
switch (settings.textSize || '') {
case 'smaller': case 'smaller':
list.push({ name: 'font-size', value: '.8em' }); list.push({ name: 'font-size', value: '.8em' });
break; break;
@ -50,7 +26,6 @@ define([], function () {
list.push({ name: 'font-size', value: '1.36em' }); list.push({ name: 'font-size', value: '1.36em' });
break; 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 {