Use pt for outline size.

This matches the units used in the theme settings UI, and allows thin outlines
to be used with large font sizes.
This commit is contained in:
James Muscat 2018-01-21 13:08:24 +00:00
parent c96c7fefea
commit bbadd9fbce
2 changed files with 39 additions and 2 deletions

View File

@ -551,7 +551,7 @@ var Display = {
"padding": "0"*/
};
if (!!theme.font_main_outline) {
mainStyle["-webkit-text-stroke"] = "" + (parseFloat(theme.font_main_outline_size) / 16.0) + "em " +
mainStyle["-webkit-text-stroke"] = "" + theme.font_main_outline_size + "pt " +
theme.font_main_outline_color;
mainStyle["-webkit-text-fill-color"] = theme.font_main_color;
}
@ -571,7 +571,7 @@ var Display = {
theme.font_main_shadow_size + "px";
}
mainStyle["padding-bottom"] = theme.display_vertical_align == VerticalAlign.Bottom ? "0.5em" : "0";
mainStyle["padding-left"] = !!theme.font_main_outline ? "" + (theme.font_main_outline_size * 2) + "px" : "0";
mainStyle["padding-left"] = !!theme.font_main_outline ? "" + (theme.font_main_outline_size * 2) + "pt" : "0";
// These need to be fixed, in the Python they use a width passed in as a parameter
mainStyle["position"] = "absolute";
mainStyle["width"] = "" + (window.innerWidth - (theme.font_main_outline_size * 4)) + "px";

View File

@ -193,6 +193,15 @@ describe("Display.setTextSlides", function () {
var slidesDiv = document.createElement("div");
slidesDiv.setAttribute("class", "slides");
document.body.appendChild(slidesDiv);
var background = document.createElement("div");
background.setAttribute("id", "global-background");
document.body.appendChild(background);
var footer = document.createElement("div");
footer.setAttribute("class", "footer");
document.body.appendChild(footer);
Display._slides = {};
});
@ -222,6 +231,34 @@ describe("Display.setTextSlides", function () {
expect(Display.reinit).toHaveBeenCalledTimes(1);
expect(Reveal.slide).toHaveBeenCalledWith(0);
});
it("should correctly set outline width", function () {
const slides = [
{
"verse": "v1",
"text": "Amazing grace, how sweet the sound\nThat saved a wretch like me\n" +
"I once was lost, but now I'm found\nWas blind but now I see"
}
];
const theme = {
'font_main_color': 'yellow',
'font_main_outline': true,
'font_main_outline_size': 42,
'font_main_outline_color': 'red'
};
spyOn(Display, "reinit");
Display.setTextSlides(slides);
Display.setTheme(theme);
const slidesDiv = $(".slides")[0];
expect(slidesDiv.style['-webkit-text-stroke']).toEqual('42pt red');
expect(slidesDiv.style['padding-left']).toEqual('84pt');
expect(slidesDiv.style['-webkit-text-fill-color']).toEqual('yellow');
})
});
describe("Display.setImageSlides", function () {