[x3d-public] Mantis Issue 1265 Text Sizing Example for X3D meeting Jan 21 2022

Andreas Plesch andreasplesch at gmail.com
Fri Jan 21 08:09:27 PST 2022


Here are a few more HTML related definitions of a text baseline:

https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/textBaseline
https://html.spec.whatwg.org/images/baselines.png
https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-textbaseline

x3dom uses top, middle, alphabetic and bottom by this logic depending on
the minor alignment:

switch ( minor_alignment )
{
case "MIDDLE":
y_offset = txtH / 2 - canvas_extra / 2;
baseLine = "middle";
textY = topToBottom ? textHeight / 2 : textHeight / 2;
break;
case "BEGIN":
y_offset = topToBottom ? 0 : txtH - canvas_extra;
baseLine = topToBottom ? "top" : "bottom";
textY = topToBottom ? 0 : textHeight; // adjust for baseline
break;
case "FIRST":
//special case of BEGIN
y_offset = topToBottom ? textHeight : txtH - canvas_extra;
baseLine = topToBottom ? "alphabetic" : "bottom";
textY = topToBottom ? textHeight : textHeight;
break;
case "END":
y_offset = topToBottom ? txtH - canvas_extra : 0;
baseLine = topToBottom ? "bottom" : "top";
textY = topToBottom ? textHeight : 0;
break;
}

https://github.com/x3dom/x3dom/blob/83ce36310eda365a35ece8391e9a8c3f78800c38/src/Texture.js#L711

Andreas


> Date: Fri, 21 Jan 2022 08:53:58 -0500
> From: "vmarchetti at kshell.com" <vmarchetti at kshell.com>
> To: Don Brutzman <brutzman at nps.edu>, X3D-Public
>         <x3d-public at web3d.org>, x3d at web3d.org
> Subject: [x3d-public] Mantis Issue 1265 Text Sizing Example for X3D
>         meeting Jan 21 2022
> Message-ID: <BFEF344E-57D9-43C8-A4C4-ECAE7AAD812D at kshell.com>
> Content-Type: text/plain; charset="us-ascii"
>
> > On Jan 20, 2022, at 7:18 PM, Brutzman, Donald (Don) (CIV) <
> brutzman at nps.edu> wrote:
> >
> > The X3D Working Group meets each Friday at 0800-0900 pacific time.
> Videoconference Connectivity:
> >
> >
> https://us02web.zoom.us/j/81634670698?pwd=a1VPeU5tN01rc21Oa3hScUlHK0Rxdz09
> <
> https://us02web.zoom.us/j/81634670698?pwd=a1VPeU5tN01rc21Oa3hScUlHK0Rxdz09
> >
> > https://zoom.us/j/148206572 <https://zoom.us/j/148206572>  Password
> 483805
> > https://www.web3d.org/member/teleconference-information <
> https://www.web3d.org/member/teleconference-information>
> >
> > All inputs welcome.  Agenda follows.
>
> > Request review of major issue by Nicholas:
> > Mantis 1265: Text size clarification, relative to baseline
> > https://www.web3d.org/member-only/mantis/view.php?id=1265 <
> https://www.web3d.org/member-only/mantis/view.php?id=1265>
> >
>
> For consideration of the Mantis 1265 issue. Attached to this email is a
> X3D file which shows a simple 2 line text block specified with spacing and
> size set to the defaults of 1.0.
> Also drawn independently are lines at  Y=-1, Y=-2 which should be
> considered the baselines for each line of text, the line at Y=0 help
> identify the global coordinate system origin:
> The left sides of each baseline are at X=0
>
> Also attached below is a screenshot of this file rendered in InstantPlayer
> 2.8 and view3dscene at version 3.19.0 ; both on Windows 10.
>
> The link at https://www.kshell.com/pages/Mantis1265/ <
> https://www.kshell.com/pages/Mantis1265/> gives links to X3DOM and X-ITE
> rendering of this file as well.
>
> Vince Marchetti
>
>
>
>
>
> > x3d-public at web3d.org <mailto:x3d-public at web3d.org>
> > http://web3d.org/mailman/listinfo/x3d-public_web3d.org <
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/1199d21c/attachment.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: TextSizingDemo.x3d
> Type: model/x3d+xml
> Size: 1165 bytes
> Desc: not available
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/1199d21c/attachment.x3d
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/1199d21c/attachment-0001.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: ScreenShot.jpeg
> Type: image/jpeg
> Size: 57047 bytes
> Desc: not available
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/1199d21c/attachment.jpeg
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/1199d21c/attachment-0002.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>
>
> ------------------------------
>
> End of x3d-public Digest, Vol 154, Issue 73
> *******************************************
>


-- 
Andreas Plesch
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20220121/985c5586/attachment-0001.html>


More information about the x3d-public mailing list