[x3d-public] special characters and fonts: extending FontStyle family/url for font file

Michalis Kamburelis michalis.kambi at gmail.com
Fri May 10 14:26:10 PDT 2024


Oh this is great extension indeed. It would be super-natural to be able to
specify URL to a OTF / TTF / etc. in FontStyle X3D node. I absolutely
support adding this to the X3D standard.

We would be happy to implement this in Castle Game Engine too. At the
engine side we of course already have classes to load fonts from any font
file (OTF, TTF, anything supported by the FreeType2). See
https://castle-engine.io/manual_text.php . This capability is now available
for people composing components in Castle Game Engine editor, or using
components from our API, but not for X3D authors -- extending FontStyle
would change this, for the better.

Whether to put it in "family" (like X_ITE does now) or "url" (like Don
describes): I think X_ITE approach, using "MFString family" for this, is
better than introducing a new field "url". That's because it means that the
"fallback" mechanism can have both URLs, and generic names (like "SERIF").
E.g. you can have

FontStyle {
  family [
    "my_serif.ttf" # prefer this, if browser can read .ttf
    "Times New Roman" # otherwise see if browser can resolve specific font
family name
    "SERIF" # otherwise fallback on generic family name
  ]
}

This makes X3D "FontStyle.family" very similar to CSS font-family (
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family ), which is
very good.

I see Don gives an argument for "url" : """author can still select a family
within that font file with unchanged functionality.""", but this is not how
it works. Once you load a font from TTF / OTF / etc. you can no longer have
"families" inside that font file. You have loaded the font file, this is
your font family, the end. Again, look at how CSS font-family works, with
success :)

@John : OpenGL doesn't have any "font library" built-in. If you use "bare"
OpenGL (not through a game engine like Castle Game Engine) then you
implement font loading and rendering yourself, e.g. using FreeType2 (to
read font files) or OS features (to use fonts installed in the system, like
Windows fonts). It is quite some work -- but you can implement everything
you want :)

Regards,
Michalis

czw., 2 maj 2024 o 12:02 John Carlson via x3d-public <x3d-public at web3d.org>
napisał(a):

> Part of the problem has been that OpenGL has not had a rich font library.
> I’m guessing people have found work arounds? Or has OpenGL improved?  Can
> we do 3D graphics in a terminal beyond some textronix emulation?  A 3D
> terminal in the web browser?
>
> “I want a terminal window shaped like patio furniture, please.” —John
> Carlson, 1986
>
> Now possible?
>
> Anyone have a version of vim3d?  Not exactly a 3D terminal.  Great idea
> instead of editing a text area, just edit the graphics!  Vim SAI?
>
> John
>
> On Thu, May 2, 2024 at 4:20 AM Brutzman, Donald (Don) (CIV) via x3d-public
> <x3d-public at web3d.org> wrote:
>
>> [Am forwarding this email thread with permission – thank you Holger.]
>>
>>
>>
>> There is a really excellent extension in X_ITE that allows authors to
>> reference a font file of interest.  Holger adapts the capabilities of the
>> MFString *family* field to achieve this, compatibly extending (and
>> retaining validation) of the existing X3D specification.  Cool!
>>
>>    - X_ITE, Font Style, Support File Formats
>>    -
>>    https://create3000.github.io/x_ite/components/text/fontstyle/#supported-file-formats
>>    - It is possible to specify in the *family* field a URL of a custom
>>    font file of the following types:
>>
>> *Encoding*
>>
>> *File Extension*
>>
>> *MIME Type*
>>
>> Open Type
>>
>> .otf
>>
>> application/x-font-opentype
>>
>> True Type
>>
>> .ttf
>>
>> application/x-font-truetype
>>
>> WOFF
>>
>> .woff
>>
>> application/x-font-woff
>>
>>
>>
>> Great thinking, adding an important capability.  Specifying fonts can
>> provide significant improvements in accessibility and also
>> internationalization (I10N) and localization (L14N) of text.   For the long
>> term, am thinking that author referral to a font file might also be done by
>> adding a *url* field, providing greater consistency with other nodes in
>> X3D, and avoiding any overloading on still-valuable functionality of
>> *family* field.  For example:
>>
>>
>>
>> *15.4.1 FontStyle*
>>
>>
>> https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/text.html#X3DFontStyleNode
>>
>>
>>
>> FontStyle : X3DFontStyleNode {
>>
>>   SFNode   [in,out] metadata    NULL    [X3DMetadataObject]
>>
>>   MFString [in,out] family      "SERIF"
>>
>>   SFBool   [in,out] horizontal  TRUE
>>
>>   MFString [in,out] justify     "BEGIN"
>> ["BEGIN"|"END"|"FIRST"|"MIDDLE"|""],["BEGIN"|"END"|"FIRST"|"MIDDLE"|""]
>>
>>   SFString [in,out] language    ""
>>
>>   SFBool   [in,out] leftToRight TRUE
>>
>>   SFFloat  [in,out] size        1.0     (0,∞)
>>
>>   SFFloat  [in,out] spacing     1.0     [0,∞)
>>
>>   SFString [in,out] style       "PLAIN"
>> ["PLAIN"|"BOLD"|"ITALIC"|"BOLDITALIC"|""]
>>
>>   SFBool   [in,out] topToBottom TRUE
>>
>>   MFString [in,out] url         []
>>
>> }
>>
>>
>>
>> The FontStyle node defines the size, family, and style used for Text
>> nodes (see 15.2.2 Text formatting), as well as the direction of the text
>> strings and any language-specific rendering techniques used for non-English
>> text. See Text for a description of the Text node.
>>
>>
>>
>> The *url* field defines a font file …
>>
>> […]
>>
>>
>>
>> Of note is that X3DOM also has an excellent mechanism to specify Web
>> fonts but it is performed at the HTML CSS level, so it is not directly
>> adaptable to native X3D in various file encodings and programming-language
>> bindings.  Example:
>>
>>    -
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveunWithX3DX3dom.xhtml
>>    - view-source:
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3DX3dom.xhtml
>>    - (see <style type="text/css"> section)
>>    - X3DOM Text Example
>>    - https://x3dom.org/x3dom/example/x3dom_text.html
>>
>> More on Web fonts:
>>
>>    - Fonts on the Web
>>    - https://www.w3.org/Font
>>    - History of the Web: The Decade-Long Path to Web Fonts
>>    - https://thehistoryoftheweb.com/web-fonts
>>    - Wikipedia: Web typography
>>    - https://en.wikipedia.org/wiki/Web_typography
>>    - https://en.wikipedia.org/wiki/Web_typography#Web_fonts
>>
>> I’ve thought for years that author inability to define fonts of interest
>> was a significant gap in X3D.  This capability by X_ITE demonstrates a
>> clear path forward.  Am thinking we should figure this out together, adopt
>> a twice-implemented consensus result as a Web3D Recommended Practice, and
>> then add it to the ISO amendment list for X3D 4.0.
>>
>>
>>
>> Prior discussion details follow, but the above provides a pretty-good
>> summary.
>>
>>
>>
>> Comments and discussion welcome.  Have fun with X3D!   😊
>>
>>
>>
>> all the best, Don
>>
>> --
>>
>> Don Brutzman  Naval Postgraduate School, Code USW/Br
>> brutzman at nps.edu
>>
>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
>> +1.831.656.2149
>>
>> X3D graphics, virtual worlds, navy robotics
>> https://faculty.nps.edu/brutzman
>>
>>
>>
>> *From:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
>> *Sent:* Wednesday, May 1, 2024 3:49 PM
>> *To:* Holger Seelig <holger.seelig at yahoo.de>
>> *Cc:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
>> *Subject:* RE: special character missing; FontStyle family/url for font
>> file
>>
>>
>>
>> Wow this is really great Holger.  Example fixed by using SERIF at
>>
>>    -
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3DIndex.html
>>    -
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3D_SerifX_ITE.png
>>
>> Very interesting and innovative capability to support font files as part
>> of *family* field.  8)  😊
>>
>>
>>
>> Am thinking that we should add *url* field instead to FontStyle, so that
>> author can still select a *family* within that font file with unchanged
>> functionality.
>>
>>
>>
>> If you agree, let’s proposed addition of *url* field on x3d-public
>> mailing list.  Given positive review plus any further insights, we might
>> then work towards elevating it as a Web3D Recommended Practice and then on
>> towards ISO as an X3D 4.0 amendment.
>>
>>
>>
>> Request your permission to share this email thread on x3d-public.  Again
>> thanks for your efforts.
>>
>>
>>
>> all the best, Don
>>
>> --
>>
>> Don Brutzman  Naval Postgraduate School, Code USW/Br
>> brutzman at nps.edu
>>
>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
>> +1.831.656.2149
>>
>> X3D graphics, virtual worlds, navy robotics
>> https://faculty.nps.edu/brutzman
>>
>>
>>
>> *From:* Holger Seelig <holger.seelig at yahoo.de>
>> *Sent:* Wednesday, May 1, 2024 3:00 AM
>> *To:* Brutzman, Donald (Don) (CIV) <brutzman at nps.edu>
>> *Subject:* Re: special character missing
>>
>>
>>
>> Hello Don,
>>
>>
>>
>> yes that is correct, X_ITE uses the Ubuntu font for SANS and TYPEWRITER
>> and Droid Serif for SERIF. The fonts do not contain all characters of the
>> UTF-8 space, but that is no reason to be sad. The FontStyle node offers the
>> possibility to specify a font family other than the default built-in fonts.
>> The family field can be used to specify a URL to a custom TTF or OTF font.
>> This allows everyone to use their favourite font and also the one in their
>> language (Emojis, Katakana, Arabic, or Chinese, ...).
>>
>>
>>
>> In X_ITE, the X3DFontStyleNode is internally an X3DUrlObject, which makes
>> this possible.
>>
>>
>> https://create3000.github.io/x_ite/components/text/fontstyle/#supported-file-formats
>>
>>
>>
>> I think everyone is at peace with this.
>>
>>
>>
>> Best regards,
>>
>> Holger
>>
>>
>>
>> PS: Coincidentally, the default SERIF font contains the smiley emoji :).
>>
>>
>>
>> --
>>
>> Holger Seelig
>>
>> Leipzig, Germany
>>
>>
>>
>> holger.seelig at yahoo.de
>>
>> https://create3000.github.io/x_ite/
>>
>>
>>
>> Am 30.04.2024 um 16:27 schrieb Brutzman, Donald (Don) (CIV) <
>> brutzman at nps.edu>:
>>
>>
>>
>> 1.   Thanks for all of the amazing things you are doing!  I hope to
>> publicize some of them soon.
>>
>>
>>
>> 2.   Looks like not all special characters are in your font set, example
>> model missing “smiley face”
>>
>>
>>
>>    -
>>    https://create3000.github.io/x_ite/playground/?url=https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3D.x3d
>>
>>
>>
>> from
>>
>>    -
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3D,x3d
>>    -
>>    https://www.web3d.org/x3d/content/examples/X3dForWebAuthors/Chapter02GeometryPrimitives/TextHaveFunWithX3DIndex.html
>>
>>
>>
>> all the best, Don
>>
>> --
>>
>> Don Brutzman  Naval Postgraduate School, Code USW/Br
>> brutzman at nps.edu
>>
>> Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA
>> +1.831.656.2149
>>
>> X3D graphics, virtual worlds, navy robotics
>> https://faculty.nps.edu/brutzman
>>
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
> _______________________________________________
> x3d-public mailing list
> x3d-public at 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/20240510/6f06cf2c/attachment-0001.html>


More information about the x3d-public mailing list