[x3d-public] draft X3D 4.1 prose for font files and libraries
Holger Seelig
holger.seelig at yahoo.de
Thu Feb 27 02:13:34 PST 2025
Synthezising font styles is usually not an option for people interested in typography. A font usually comes in different styles, which are finely worked out and usually contain special features that cannot be achieved by synthesising, i.e. they usually look bad, but often are perfectly suitable for manually creating a new style from them.
FontStyle node with url is a good idea and also easy to implement. I think it is enough to load one font:
FontStyle {
url "DejaVuSerif-Italic.ttf"
style "BOLD"
}
that's simple and is actually enough, otherwise it gets more complicated, and as Michalis already said the style doesn't matter in this case.
Best regards,
Holger
--
Holger Seelig
Leipzig, Germany
holger.seelig at yahoo.de
https://create3000.github.io/x_ite/
> Am 27.02.2025 um 04:41 schrieb Michalis Kamburelis via x3d-public <x3d-public at web3d.org>:
>
> Nice, I see the core addition here is adding "url" to the "FontStyle", which can point to a font file (like WOFF, TTF, OTF). This makes perfect sense and should be easy to implement and useful for authors. The prose makes it clear that only *one* item from the "FontStyle.url" list is used, which is standard in X3D usage of "MFString url", good.
>
> Some feedback:
>
> 1. The text uses new terms: "font definition", "font library". I would advise to clearly define (and give examples) what is meant by each term (and maybe you don't really need all of them?). As always, testcase files would be great :)
>
> Admittedly, I don't fully understand myself what do you mean by "font definition", "font library". The terms I know, when working with fonts, are :
>
> A. "font file" (this is a single WOFF, TTF, OTF file).
>
> B. And "font family" (this is usually using 4 files, regular / italic / bold+italic / bold).
>
> In CGE, this is TCastleFontFamily component, corresponds to https://castle-engine.io/apidoc/html/CastleFonts.TCastleFontFamily.html .
>
> In CSS, this is called font-family. See e.g. https://stackoverflow.com/questions/12812441/how-do-i-use-woff-fonts-for-my-website how to use 4 WOFF files to define a CSS font-family.
>
> In X3D itself, the "FontStyle.family" also allows to choose from (system-level or browser-level) font families. So it's all good and consistent so far.
>
> Admittedly, I'm unsure how/if do my above terms map to "font library" and "font definition" terms that the spec on https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/components/text.html#FontStyle uses. The spec mentions "a font library that contains one or more font definitions". Can you show me (point to concrete testcases) what do you mean? What is a simple file that is "a font library with one font definition"? What is a simple file that is "a font library with multiple font definitions"?
>
> 2. It may be worth saying explicitly in the prose that:
>
> - When some font file indicated by "url" is successfully loaded, then the "FontStyle.family" no longer maters. The font is defined by the given URL.
>
> - When some font file indicated by "url" is successfully loaded (and it only contains a single font definition?) then the "FontStyle.style" (bold, italic..) also doesn't matter.
>
> That is, consider this:
>
> FontStyle { url "DejaVuSerif-Italic.ttf" }
>
> DejaVu is an open-source font, distributed also by Debian, and used by CGE, you can experiment with files on https://github.com/castle-engine/castle-engine/tree/master/src/fonts/data .
>
> ... then the "style" doesn't matter. That is, in this example:
>
> FontStyle {
> url "DejaVuSerif-Italic.ttf"
> style "BOLD"
> }
>
> ... the style "BOLD" value is ignored. Because you use "DejaVuSerif-Italic.ttf", so this is italic (and not bold) version of DejaVu. If someone wants bold, they should have used "DejaVuSerif-Bold.ttf".
>
> 3. In CGE, it is possible to use a collection of .ttf / .otf to define a font. Speculating, something like this (matching https://castle-engine.io/apidoc/html/CastleFonts.TCastleFontFamily.html ) could be available to express this in X3D:
>
> """
> Shape {
> geometry Text {
> fontStyle FontStyle {
> familyComposed DEF DejaVu FontFamily {
> regularUrl "DejaVuSerif.ttf"
> italicUrl "DejaVuSerif-Italic.ttf"
> boldUrl "DejaVuSerif-Bold.ttf"
> boldItalicUrl "DejaVuSerif-BoldItalic.ttf"
> }
> }
> string "this has regular style"
> }
> }
>
> Shape {
> geometry Text {
> fontStyle FontStyle {
> composedFontFamily USE DejaVu
> style "ITALIC"
> }
> string "this has italic style"
> }
> }
>
> Shape {
> geometry Text {
> fontStyle FontStyle {
> composedFontFamily USE DejaVu
> style "BOLDITALIC"
> }
> string "this has italic+bold style"
> }
> }
> """
>
> 4. I wonder whether the FontLibrary that you mentioned will fulfill some of the use-cases I mentioned above and answer some of my questions :) No rush, I understand this is in the design phase, I'll want and see what you propose, maybe when I see FontLibrary -> the above points will no longer matter because everything will be obvious.
>
> Regards,
> Michalis
>
> czw., 27 lut 2025 o 02:40 Brutzman, Donald (Don) (CIV) via x3d-public <x3d-public at web3d.org <mailto:x3d-public at web3d.org>> napisał(a):
>> Dick and I worked on suggested prose for X3D 4.1 with details continuing in Mantis 1490 below.
>>
>> Review request:
>> X3D 4.1 Architecture (draft), 15 Text component, 15.4.1 FontStyle
>> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/components/text.html#FontStyle
>> Improvements:
>> Include all X3DURLObject fields,
>> SFTime [in,out] autoRefresh 0.0 [0,∞)
>> SFTime [in,out] autoRefreshTimeLimit 3600.0 [0,∞)
>> SFString [in,out] description ""
>> SFBool [in,out] load TRUE
>> MFString [in,out] url [] [URI]
>> Decided to NOT overload functionality of family field by adding file names (sorry Holger! adjusting your implementation will likely be simple in comparison)
>>
>> New prose:
>> The url field is optional and can refer to a relative or online address for a font library that contains one or more font definitions. An empty url list indicates that the default set of fonts provided by the browser are used. If present, only the first active font library retrieved from the url list shall be used. Individual font library files can be used by multiple FontStyle nodes in a scene. Each font file only needs to be loaded once per session.
>> X3D browsers shall support WOFF (MIME type application/x-font-woff) (see W3C WOFF File Format <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/references.html#W3C_WOFF>). Support for the OpenType file format (MIME type application/x-font-opentype) (see OpenType Specification <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/bibliography.html#OPENTYPE>) and TrueType file format (MIME type application/x-font-truetype) (see ISO/IEC 14496-22 Open Font Format <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/references.html#I14496_22>) is also recommended.
>> Security, licensing, and copyright/usage permissions are handled via the exposure of a font file itself.
>> Support for the autoRefresh, autoRefreshTimeLimit, and load fields is optional.
>> More details on the autoRefresh, autoRefreshTimeLimit, description, load, and url fields are contained in 9.2.1 URLs, URNs and URIs <https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/components/networking.html#URLs>.
>> Looking it over, adding more functionality to FontStyle node seems to be unwise. Dick has an excellent proposal:
>> TODO alternative approach: move all new functionality into a separate FontLibrary node to avoid complicating FontStyle further. This also offers the ability to succinctly load multiple font libraries in a given scene. The expense of defining a new node for X3D is offset by clearer distinction between X3D 4.0 and 4.1, also simplifying model content significantly.
>> Feedback is welcome.
>> Leaving existing FontStyle implementations alone probably avoids many unintended side effects. First law of engineering: "If it ain't broke, don't fix it."
>>
>> Thanks for all review. It feels like we are finally converging on a straightforward approach to valuable future capabilities.
>>
>> Have fun with X3D fonts! 😎
>>
>> all the best, Don
>> --
>> Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu <mailto: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 <mailto:brutzman at nps.edu>>
>> Sent: Monday, February 24, 2025 9:32 AM
>> To: X3D <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>> Cc: Holger Seelig <holger.seelig at yahoo.de <mailto:holger.seelig at yahoo.de>>
>> Subject: Re: [x3d-public] Open dyslexic and/or (unfortunately) comicsans fonts; draft X3D 4.1 prose for font files and libraries
>>
>> Wow, really super Holger! 🙂
>>
>> There was a conversation about this on x3d-public a few years back... We committed to adding it in X3D 4.1 and (if I recall correctly) also noted that adding a url field might enable usage of larger font files.
>>
>> I've attempted to capture this candidate specification change in a Mantis issue. All review, feedback, and improvements are always welcome.
>> Mantis 1490 FontStyle handling of font files and font libraries
>> https://mantis.web3d.org/view.php?id=1490
>> Description.
>> A goal for X3D 4.1 is use of font files in FontStyle (see Mantis 0001464 <https://mantis.web3d.org/view.php?id=1464>).
>>
>> Addition of individual-font files might be accomplished by listing the font file name in the FontStyle 'family' field.
>>
>> Referencing different fonts in a single combined font library file may require an additional field, for example 'url'. In general the use of a font library may be preferred, but repeatedly run-time retrieval of a font library is not desirable, since the file might be quite large and rarely changing. This might be noted in the specification prose, e.g.
>>
>> - "MFString [in,out] url [] [URI]"
>> - "The family field may list a specific font file. A font listed in the family field may be provided by a corresponding font library."
>> - "The url field may refer to a font library. Font libraries can be used by multiple FontStyle nodes in a scene and need only be loaded once per session."
>>
>> Support levels: add "Level 2, FontStyle, support for font files in family field and support for font libraries via url field ."
>>
>> Security, licensing, and copyright/usage issues are handled via the exposure of the font file itself. If retrievable (locally or online) then proper access is presumably handled separately.
>>
>> Additional information.
>> - X3D 4.1 (draft) Architecture, 15 Text component, 15.4.1 FontStyle
>> - https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/text.html#FontStyle
>>
>> - X3D 4.1 (draft) Architecture, 15 Text component, 15.4.2 Text
>> - https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/text.html#Text
>>
>> - X3D 4.1 (draft) Architecture, 15 Text component, 15.5 Support levels
>> - https://www.web3d.org/specifications/X3Dv4/ISO-IEC19775-1v4-IS/Part01/components/text.html#SupportlLevels
>>
>> Have fun with X3D Text! :)
>>
>> all the best, Don
>> --
>> Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu <mailto: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: x3d-public <x3d-public-bounces at web3d.org <mailto:x3d-public-bounces at web3d.org>> on behalf of Holger Seelig via x3d-public <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>> Sent: Monday, February 24, 2025 2:48 AM
>> To: X3D <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>
>> Cc: Holger Seelig <holger.seelig at yahoo.de <mailto:holger.seelig at yahoo.de>>
>> Subject: Re: [x3d-public] Open dyslexic and/or (unfortunately) comicsans fonts
>>
>> With X_ITE you can use a URL in the family field of a FontStyle node to specify a path to a custom font file. Provided you have one of these fonts, it should be very easy:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 4.0//EN" "https://www.web3d.org/specifications/x3d-4.0.dtd">
>> <X3D profile='Interchange' version='4.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-4.0.xsd'>
>> <head>
>> <component name='Text' level='1'/>
>> </head>
>> <Scene>
>> <Transform DEF='Text'>
>> <Shape>
>> <Appearance>
>> <Material/>
>> </Appearance>
>> <Text
>> string='"3D Text"'>
>> <FontStyle
>> family='"path/to/your/font.otf", "SERIF"'/>
>> </Text>
>> </Shape>
>> </Transform>
>> </Scene>
>> </X3D>
>>
>> Supported File Formats:
>> https://create3000.github.io/x_ite/components/text/fontstyle/#supported-file-formats
>>
>> Best regards,
>> Holger
>>
>> --
>> Holger Seelig
>> Leipzig, Germany
>>
>> holger.seelig at yahoo.de <mailto:holger.seelig at yahoo.de>
>> https://create3000.github.io/x_ite/
>>
>> Am 24.02.2025 um 11:09 schrieb John Carlson via x3d-public <x3d-public at web3d.org <mailto:x3d-public at web3d.org>>:
>>
>> If someone knows how change the fonts of the standards to OpenDyslexic or ComicSans, that might be a great accessibility experiment. _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org <mailto:x3d-public at web3d.org>
>> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
>>
>> _______________________________________________
>> x3d-public mailing list
>> x3d-public at web3d.org <mailto: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/20250227/03fe31c0/attachment-0001.html>
More information about the x3d-public
mailing list