forked from openlp/openlp
Use point size for text outline.
The previous code matched the erroneous behaviour of the original Python method, which used `em` as a measurement; the theme wizard uses `pt` as a unit and doesn't allow fractional values, which meant that it was not possible to specify very thin outlines at large font sizes. Now, both UI and rendering code use `pt` as a unit, which allows thin outlines.
This commit is contained in:
commit
7539483959
@ -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";
|
||||
@ -622,7 +622,6 @@ var Display = {
|
||||
}
|
||||
return videoTypes;
|
||||
}
|
||||
}
|
||||
};
|
||||
new QWebChannel(qt.webChannelTransport, function (channel) {
|
||||
window.mediaWatcher = channel.objects.mediaWatcher;
|
||||
|
@ -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 () {
|
||||
|
Loading…
Reference in New Issue
Block a user