Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(developer): escape font facename in touch layout editor #13020

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions developer/src/tike/xml/layoutbuilder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,13 @@ $(function() {
return builder.renameSpecialKey(hint);
}

this.escapeFontName = function(fontName) {
if(!fontName) {
return "";
}
return JSON.stringify(fontName);
}

this.prepareLayer = function () {
var layer = KVKL[builder.lastPlatform].layer[builder.lastLayerIndex];

Expand Down Expand Up @@ -380,11 +387,11 @@ $(function() {
}

$('#kbd,#sub-key-groups')
.css('font-family', KVKL[builder.lastPlatform].font)
.css('font-family', this.escapeFontName(KVKL[builder.lastPlatform].font))
.css('font-size', KVKL[builder.lastPlatform].fontsize || "1em");

$('#inpKeyCap,#inpSubKeyCap')
.css('font-family', KVKL[builder.lastPlatform].font)
.css('font-family', this.escapeFontName(KVKL[builder.lastPlatform].font))
.css('font-size', '18pt');

$('#kbd div').remove();
Expand Down Expand Up @@ -421,7 +428,7 @@ $(function() {
.css('height', (100 * this.yscale) + 'px')
.css('margin-top', (builder.keyMargin * this.yscale) + 'px')
.css('margin-left', p + 'px')
.css('font-family', key.font)
.css('font-family', this.escapeFontName(key.font))
.css('font-size', key.fontsize);

if(this.specialCharacters[text])
Expand Down
2 changes: 1 addition & 1 deletion developer/src/tike/xml/layoutbuilder/prepare-key.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ $(function() {
.data('direction', key.direction) // used only by flicks
.data('default', key.default) // used only by longpress
.css('width', (100 * 0.7) + 'px')
.css('font-family', key.font)
.css('font-family',builder.escapeFontName(key.font))
.css('font-size', key.fontsize);

if(builder.specialCharacters[text]) {
Expand Down
Loading