diff --git a/web/history.md b/web/history.md index 7ce68315d2..dd9e80727b 100644 --- a/web/history.md +++ b/web/history.md @@ -3,6 +3,10 @@ ## 13.0 alpha * Start version 13.0 +## 2019-09-04 12.0.80 beta +* Fixed issue with 'pt' and unitless font size specifications for keyboard layouts (#2033) +* Slightly enhanced error logging for internal events (#2037) + ## 2019-09-03 12.0.79 beta * Tweaks suggestion banner behavior after multiple backspaces. (#2027) diff --git a/web/source/kmwutils.ts b/web/source/kmwutils.ts index 4a40b54d54..42507e0214 100644 --- a/web/source/kmwutils.ts +++ b/web/source/kmwutils.ts @@ -375,11 +375,22 @@ namespace com.keyman { } else if(fs.indexOf('px') != -1) { val = parseFloat(fs.substr(0, fs.indexOf('px'))); return {val: val, absolute: true}; + } else if(fs.indexOf('pt') != -1) { + // 16 px ~= 12 pt. + // Reference: https://kyleschaeffer.com/css-font-size-em-vs-px-vs-pt-vs-percent + val = parseFloat(fs.substr(0, fs.indexOf('pt'))); + return {val: (4 * val / 3), absolute: true}; } else if(fs.indexOf('%') != -1) { val = parseFloat(fs.substr(0, fs.indexOf('%'))); return {val: val/100, absolute: false}; + } else if(!isNaN(val = Number(fs))) { + // Note: this one is NOT natively handled by browsers! + // We'll treat it as if it were 'pt', since that's likely the user's + // most familiar font size unit. + return {val: (4 * val / 3), absolute: true}; } else { // Cannot parse. + console.error("Could not properly parse specified fontsize info: '" + fs + "'."); return null; } }