diff --git a/codemirror/themes/qb45.css b/codemirror/themes/qb45.css index 2468d40..d24f1ee 100644 --- a/codemirror/themes/qb45.css +++ b/codemirror/themes/qb45.css @@ -45,7 +45,6 @@ body { background-color: rgb(0, 0, 170); - letter-spacing: -1px; } #gx-container { diff --git a/codemirror/themes/qb64-vscode.css b/codemirror/themes/qb64-vscode.css index bbbbda6..0c3689f 100644 --- a/codemirror/themes/qb64-vscode.css +++ b/codemirror/themes/qb64-vscode.css @@ -45,11 +45,6 @@ body { background-color: #0000AA; - letter-spacing: -1px; -} - -#gx-container { - letter-spacing: normal; } #code, #gx-container, #toolbar, #toolbar .spacer, .tab, #output-content { diff --git a/codemirror/themes/qbjs.css b/codemirror/themes/qbjs.css index b115755..dc6bf81 100644 --- a/codemirror/themes/qbjs.css +++ b/codemirror/themes/qbjs.css @@ -1,7 +1,7 @@ .cm-s-qbjs { line-height: 1em; } -.cm-s-qbjs.CodeMirror { background: rgb(0, 0, 39); color: rgb(216, 216, 216); text-shadow: 0 -1px 1px #262626; font-family: dosvga; letter-spacing: -1px} +.cm-s-qbjs.CodeMirror { background: rgb(0, 0, 39); color: rgb(216, 216, 216); text-shadow: 0 -1px 1px #262626; font-family: dosvga; } .cm-s-qbjs div.CodeMirror-selected { background: #45443B; } /* 33322B*/ .cm-s-qbjs .CodeMirror-line::selection, .cm-s-qbjs .CodeMirror-line > span::selection, .cm-s-qbjs .CodeMirror-line > span > span::selection { background: rgba(0, 49, 78, .99); } .cm-s-qbjs .CodeMirror-line::-moz-selection, .cm-s-qbjs .CodeMirror-line > span::-moz-selection, .cm-s-qbjs .CodeMirror-line > span > span::-moz-selection { background: rgba(69, 68, 59, .99); } @@ -46,9 +46,6 @@ .cm-s-qbjs .CodeMirror-search-field { font-family: dosvga; font-size: 1em; } .cm-s-qbjs .cm-searching { color: #333 !important; background-color: #ccc; } -body { letter-spacing: -1px; } -#gx-container { letter-spacing: normal; } - #help-nav a:hover { color: #fff; } #help-nav a:before { content: "< "; } #help-nav a:after { content: " >"; } diff --git a/codemirror/themes/vscode-dark.css b/codemirror/themes/vscode-dark.css index aa03859..0fb9406 100644 --- a/codemirror/themes/vscode-dark.css +++ b/codemirror/themes/vscode-dark.css @@ -59,7 +59,6 @@ body { #slider { font-family: dosvga; - letter-spacing: -1px; } a, #tabs { @@ -89,7 +88,6 @@ a, #tabs { dialog textarea { font-family: Consolas, 'Courier New', monospace; - letter-spacing: normal; background-color: #1e1e1e; color: #ccc; } diff --git a/codemirror/themes/win-classic.css b/codemirror/themes/win-classic.css index e530b52..8506d67 100644 --- a/codemirror/themes/win-classic.css +++ b/codemirror/themes/win-classic.css @@ -20,7 +20,6 @@ .cm-s-win-classic .cm-header { color: #FF6400; } .cm-s-win-classic .cm-hr { color: #AEAEAE; } .cm-s-win-classic .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } -/*.cm-s-win-classic .cm-error { border-bottom: 1px solid red; }*/ div.cm-s-win-classic .CodeMirror-activeline-background { background: #efefff; } div.cm-s-win-classic span.CodeMirror-matchingbracket { outline:1px solid grey; color: inherit; } @@ -51,7 +50,6 @@ li a:active { border: 0; } dialog textarea { font-family: 'Courier New', monospace; font-size: 14px; - letter-spacing: normal; border: 2px inset; } dialog textarea:focus { @@ -65,7 +63,6 @@ dialog { #code { border: 2px inset; - /*border-top: 0;*/ font-size: 14px; } @@ -73,7 +70,6 @@ dialog { #output-content, #warning-container { font-family: 'Courier New', monospace; - /*font-size: 14px;*/ } #output-content { diff --git a/export/qbjs.css b/export/qbjs.css index 7141a08..00eaf02 100644 --- a/export/qbjs.css +++ b/export/qbjs.css @@ -1,11 +1,10 @@ @font-face { font-family: dosvga; - src: url(dosvga.ttf); + src: url(qbjs.woff2); } body { background-color: #000; font-family: dosvga, Arial, Helvetica, sans-serif; - letter-spacing: -1px; color: #999; } #gx-container { diff --git a/qb.js b/qb.js index c454834..a8bca3a 100644 --- a/qb.js +++ b/qb.js @@ -60,7 +60,6 @@ var QB = new function() { var _windowDef = []; var _fileHandles = null; var _typeMap = {}; - var _letterSpacingSupport = null; // Array handling methods @@ -394,14 +393,6 @@ var QB = new function() { }; this.sub__Font = function(fnt) { - if (fnt < 1000) { - GX.ctx().letterSpacing = "-1px"; - GX.canvas().style.letterSpacing = "-1px"; - } - else { - GX.ctx().letterSpacing = "0px"; - GX.canvas().style.letterSpacing = "normal"; - } _font = fnt; _locX = 0; _lastTextX = 0; @@ -751,43 +742,23 @@ var QB = new function() { ctx.beginPath(); var f = _fonts[_font]; ctx.font = f.size + " " + f.name; - // ------------------------------------------------------------------ - // special case for built-in fonts and safari - // if safari adds 2d canvas letterSpacing support this can be removed - if (!_letterSpacingSupport && _font < 1000) { - for (var i=0; i < s.length; i++) { - var ch = s.substring(i, i+1); - if (_printMode != QB._KEEPBACKGROUND) { - ctx.fillStyle = _bgColor.rgba(); - ctx.fillRect(x + (i * QB.func__FontWidth()), y, QB.func__FontWidth(), QB.func__FontHeight()); - } - if (_printMode != QB._ONLYBACKGROUND) { - // Draw the string - ctx.fillStyle = _fgColor.rgba(); - ctx.fillText(ch, x + (i * QB.func__FontWidth()), y + QB.func__FontHeight() - f.offset); - } - } + var tm = ctx.measureText(s); + var fheight = 0; + if (tm.fontBoundingBoxAscent) { + fheight = tm.fontBoundingBoxAscent + tm.fontBoundingBoxDescent; } - // ------------------------------------------------------------------ else { - var tm = ctx.measureText(s); - var fheight = 0; - if (tm.fontBoundingBoxAscent) { - fheight = tm.fontBoundingBoxAscent + tm.fontBoundingBoxDescent; - } - else { - fheight = tm.actualBoundingBoxAscent + tm.actualBoundingBoxDescent; - } - - if (_printMode != QB._KEEPBACKGROUND) { - ctx.fillStyle = _bgColor.rgba(); - ctx.fillRect(x, y, tm.width, fheight); - } - if (_printMode != QB._ONLYBACKGROUND) { - // Draw the string - ctx.fillStyle = _fgColor.rgba(); - ctx.fillText(s, x, y + fheight - f.offset); - } + fheight = tm.actualBoundingBoxAscent + tm.actualBoundingBoxDescent; + } + + if (_printMode != QB._KEEPBACKGROUND) { + ctx.fillStyle = _bgColor.rgba(); + ctx.fillRect(x, y, tm.width, fheight); + } + if (_printMode != QB._ONLYBACKGROUND) { + // Draw the string + ctx.fillStyle = _fgColor.rgba(); + ctx.fillText(s, x, y + fheight - f.offset); } }; @@ -2408,38 +2379,17 @@ var QB = new function() { } var y = _locY * QB.func__FontHeight(); - // ------------------------------------------------------------------ - // special case for built-in fonts and safari - // if safari adds 2d canvas letterSpacing support this can be removed - if (!_letterSpacingSupport && _font < 1000) { - for (var i=0; i < subline.length; i++) { - var ch = subline.substring(i, i+1); - if (_printMode != QB._KEEPBACKGROUND) { - ctx.fillStyle = _bgColor.rgba(); - ctx.fillRect(x + (i * QB.func__FontWidth()), y, QB.func__FontWidth(), QB.func__FontHeight()); - } - if (_printMode != QB._ONLYBACKGROUND) { - // Draw the string - ctx.fillStyle = _fgColor.rgba(); - ctx.fillText(ch, x + (i * QB.func__FontWidth()), y + QB.func__FontHeight() - f.offset); - } - } - x += QB.func__FontWidth(); + // Draw the text background + var tm = ctx.measureText(subline); + if (_printMode != QB._KEEPBACKGROUND) { + ctx.fillStyle = _bgColor.rgba(); + ctx.fillRect(x, y, tm.width, QB.func__FontHeight()); } - // ------------------------------------------------------------------ - else { - // Draw the text background - var tm = ctx.measureText(subline); - if (_printMode != QB._KEEPBACKGROUND) { - ctx.fillStyle = _bgColor.rgba(); - ctx.fillRect(x, y, tm.width, QB.func__FontHeight()); - } - if (_printMode != QB._ONLYBACKGROUND) { - ctx.fillStyle = _fgColor.rgba(); - ctx.fillText(subline, x, (y + QB.func__FontHeight() - f.offset)); - } - x += tm.width; + if (_printMode != QB._ONLYBACKGROUND) { + ctx.fillStyle = _fgColor.rgba(); + ctx.fillText(subline, x, (y + QB.func__FontHeight() - f.offset)); } + x += tm.width; _locX += subline.length; } @@ -2958,10 +2908,6 @@ var QB = new function() { _keyDownMap = {}; // TODO: set the appropriate default font for the selected screen mode above instead of here - if (_letterSpacingSupport == null) { - _letterSpacingSupport = (GX.ctx().letterSpacing) ? true : false; - } - QB.sub__Font(_font); }; this.func_Seek = function(fh) { diff --git a/qbjs-ide.css b/qbjs-ide.css index 9748a7d..2d83bad 100644 --- a/qbjs-ide.css +++ b/qbjs-ide.css @@ -1,6 +1,6 @@ @font-face { font-family: dosvga; - src: url(dosvga.ttf); + src: url(qbjs.woff2); } body { background-color: rgb(0, 0, 39); @@ -47,7 +47,6 @@ a:after { content: " >"; } #gx-canvas { border: 1px solid #222; background-color: #000; - letter-spacing: -1px; font-family: dosvga; } #output-container { @@ -187,7 +186,6 @@ dialog textarea, #prog-sel-dialog select { font-family: dosvga; font-size: 1em; - letter-spacing: -1px; background-color: #efefef; padding: 5px; } diff --git a/qbjs-ide.js b/qbjs-ide.js index 0363758..2cfbd47 100644 --- a/qbjs-ide.js +++ b/qbjs-ide.js @@ -365,7 +365,7 @@ var IDE = new function() { zip.file("fullscreen.svg", await getFile("export/fullscreen.svg", "blob")); zip.file("fullscreen-hover.svg", await getFile("export/fullscreen-hover.svg", "blob")); zip.file("logo.png", await getFile("export/logo.png", "blob")); - zip.file("dosvga.ttf", await getFile("dosvga.ttf", "blob")); + zip.file("qbjs.woff2", await getFile("qbjs.woff2", "blob")); zip.file("play.png", await getFile("play.png", "blob")); zip.file("qbjs.css", await getFile("export/qbjs.css", "text")); zip.file("qb.js", await getFile("qb.js", "text")); diff --git a/qbjs.woff2 b/qbjs.woff2 new file mode 100644 index 0000000..c336f45 Binary files /dev/null and b/qbjs.woff2 differ