groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [groff] Now online: gropdf / grops previewer


From: John Gardner
Subject: Re: [groff] Now online: gropdf / grops previewer
Date: Mon, 23 Apr 2018 13:59:32 +1000

Hey Branden,

> I'd love to see what the source looks like, but when I alter the URL, I
> get a bunch of 404s.

Everything is on GitHub <https://github.com/Alhadis/Roff.js>. The
browser-friendly version is on a separate branch
<https://github.com/Alhadis/Roff.js/tree/web-demo>, as I had to do a few
hacks to address the dependencies on an Electron/Node.js environment.

However, the code for panning and zooming was made a separate project
<https://github.com/Alhadis/PanAndZoom>. Achieving the effect in a
browser-efficient manner was oddly involved, and it felt too heavyweight to
lump in with the rest of the Roff-specific work. The code works, I just
realised I need to clamp it to a certain range.

Trouble is, that range will vary. Zooming won't always be smack in the
dead-centre, either. While not implemented in the web-demo, there will be a
"double-click to zoom in" functionality that should logically centre on
wherever the user clicked.

Complicating matters further is the fact the window pane's width will vary
depending on how wide the user's scaled it, and the fact that manually
setting scroll offsets to compensate for zooming causes a visible "jolt"
because they happen on different redraws... I may have to implement
scrolling manually.

I found a possible Unicode handling problem. In the attached ditroff
> output, note that the angle brackets around the email address in the
> "AUTHORS" section are rendered as different glyphs altogether.


I'm seeing angle brackets: ⟨ ⟩, U+27E8 and U+27E9, respectively. This may
be font-related. The "special" font is used for displaying symbols, which
maps to the first available font in the following list:

- Standard Symbols PS
- Standard Symbols L
- Symbol
- serif
- oblique


The first two are included in the URW Base35 fonts, which as I explained
are sanely omitted from the web-demo, as it would add a big hit to
load-time. =) Could you try installing the StandardSymbolsPS font from
GhostScript's fonts repo?


On 23 April 2018 at 09:34, G. Branden Robinson <address@hidden
> wrote:

> At 2018-04-23T09:04:25+1000, John Gardner wrote:
> > Well, here it is:
> >
> > https://rawgit.com/Alhadis/Roff.js/web-demo/index.html
> >
> > Some modifications were needed for web-delivery, and performance still
> > isn't optimal, but it works. You'll need a relatively recent browser to
> use
> > it (anything released within the last year should do).
> >
> > Few things to note before you try it:
>
> This looks fantastic!  Thank you for doing this work!
>
> I'd love to see what the source looks like, but when I alter the URL, I
> get a bunch of 404s.
>
> >    - *Some fonts may look different.* Browsers handle font-rendering,
> which
> >    means the base 35 PDF fonts won't be visible in the renderer unless
> they've
> >    also been installed in your system's usual fonts directory.
>
> I found a possible Unicode handling problem.  In the attached ditroff
> output, note that the angle brackets around the email address in the
> "AUTHORS" section are rendered as different glyphs altogether.
>
> >    - *There's an issue with zooming.* This is what I'm stuck on, and when
> >    Branden offered help with matrix calculations, I decided the best way
> of
> >    explaining was with a working demo.
> >
> >    If you zoom in using the *100%* menu, you'll notice you can't scroll
> >    left or upwards. That's because the page contents extend past the
> top-left
> >    corner of the browser window, and we all know you can't scroll past
> the
> >    window's origin corner.
>
> I see what you mean.  I don't think there's a matrix math problem here.
> If I had to guess, you are doing a coordinate transform from document
> coordinates to canvas (and/or browser window) coordinates, and clamping
> the wrong pair.
>
> For instance, if I zoom a document to 150%, there is obviously document
> content off-screen to the left.  So the x coordinate is negative in the
> browser window, but of course it is still positive in the document's
> coordinate frame.
>
> I know nothing about JavaScript frameworks (apart from the existence of
> this "canvas" thing, which is a fairly generic term for a drawing window
> anyway).
>
> Anyway, if I can get my hands on the source, maybe we can put our heads
> together on the problem.
>
> Great work!
>
> --
> Regards,
> Branden
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]