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

Errors in 'article' example #33

Open
PhilterPaper opened this issue Jun 1, 2022 · 2 comments
Open

Errors in 'article' example #33

PhilterPaper opened this issue Jun 1, 2022 · 2 comments

Comments

@PhilterPaper
Copy link

PhilterPaper commented Jun 1, 2022

In order to get the example/article to display correctly (none of the five "canvas" samples show up), I needed to make a couple of corrections in the align() function of index.html:

  1. In recently added line devicePixelRatio = window.devicePixelRatio || 1; the semicolon must be changed to a comma: devicePixelRatio = window.devicePixelRatio || 1, or else bad things happen. This is clearly a coding error, as the next line format, nodes, breaks; is clearly meant to be the end of the var statement.
  2. A few lines later, I had to comment out the entire line canvas.scale(devicePixelRatio, devicePixelRatio);. If I don't, there's no sign that it ever gets past this statement (window.alert("I just did the scale"); doesn't show up). devicePixelRatio has a value of "1", so it shouldn't be making any difference. I'm not sure what's going wrong here, but since the scale factor is 1 anyway, no harm done.

This was tried on the current Firefox browser. It works great with the two changes (all five canvas samples now show up). Does it display OK (without change) on other browsers? Incidentally, the same "article" works OK on the frobnitzem/typeset fork.

Add: Is there anything I can do or set in Javascript to flag the errors I reported above? It just silently glided past these errors without saying a word (just not working as expected). I find that most unsatisfactory. Flagging undeclared variables, flagging syntax errors, and reporting runtime errors is the bare minimum for any decent language!

@PhilterPaper
Copy link
Author

A further problem: the "assisted browser line breaks" example has a lot of problems with gaps within words, such as "bal l". It's not hyphenation points; I can't tell what it is -- do others see this issue? Firefox browser on Windows 10.

I thought there was a problem with split words in the canvas examples missing their hyphen, but it turned out I had changed the penalty from 100 to 3000 for this (see #27 and #22), and needed to update a line of code checking if a hyphen needed to be inserted.

@PhilterPaper
Copy link
Author

PhilterPaper commented Sep 23, 2022

At least in Firefox, there are a few flavors of browser console around. These will flag various errors, but it's still bad that in normal operation the browser goes silently by even severe errors. Anyway, the Perl version (Text::KnuthPlass) is coming along nicely, and will eventually include both "Flatland" and "Article" examples.

Add: Flatland is included in the new Text::KnuthPlass 1.07 release, while Article needs to wait until some enhancements are made to PDF::Builder to embed italic, bold, etc. in text.

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

No branches or pull requests

1 participant