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

[brd] Not rendering because of invalid 'font' lookup #82

Open
abetusk opened this issue Oct 19, 2015 · 0 comments
Open

[brd] Not rendering because of invalid 'font' lookup #82

abetusk opened this issue Oct 19, 2015 · 0 comments

Comments

@abetusk
Copy link
Owner

abetusk commented Oct 19, 2015

Implemented a hot fix to take care of some bad font issues:

diff --git a/js/core/bleepsixRender.js b/js/core/bleepsixRender.js
index 4660bfc..d5f3ff3 100644
--- a/js/core/bleepsixRender.js
+++ b/js/core/bleepsixRender.js
@@ -1202,6 +1202,7 @@ bleepsixRender.prototype._font_text_width = function(text, font, xsize)
   {
     var ch_ord = text.charCodeAt(i);
     var f = font[ch_ord];
+    if (typeof f === "undefined") { continue; }
     var dx = xsize * (parseFloat(f.xsto) - parseFloat(f.xsta)) * scale ;
     tally += dx;
   }
@@ -1277,6 +1278,7 @@ bleepsixRender.prototype.drawTextFont =


     var f = font[ch_ord];
+    if (typeof f === "undefined") { continue; }

     var xsta = scale * parseFloat(f.xsta) * sizex;
     var xsto = scale * parseFloat(f.xsto) * sizex;

From inspection, ch_ord was 0 so the lookup failed. I'm wondering how this happened in the first place.

Bug was noticed by a user that placed three resistors, deleted them, placed three more and renamed them to 'R1', 'R2' and 'R3' respectively.

This should be investigated a bit more to figure out where these errors were coming from.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant