[x3d-public] draft X3D 4.1 prose for font files and libraries

Andreas Plesch andreasplesch at gmail.com
Fri Mar 14 07:20:24 PDT 2025


On test cases:

On Fri, Mar 14, 2025 at 6:40 AM Michalis Kamburelis <
michalis.kambi at gmail.com> wrote:

> From my side:
>
> 1. [ good arguments for FontSyle.url . Since this was the clearest option
> it was immediately adopted for x3dom ]
>
> 2. In case my plea from AD 1 is ignored, we at least definitely need
> more testcases covering the questions from AD 1. I already made some,
>
> https://github.com/michaliskambi/x3d-tests/tree/master/font_library_questions
> . I ask people who push for this design of FontLibrary to provide more
> testcases.
>
>     To be clear, a testcase must be a complete X3D file (not only a
> snippet), and it should be accompanied by a text (README file, or
> comment inside X3D file) describing the desired effect. It should be
> "complete" (so, provide also font files, and all other files
> referenced by Inline, EXTERNPROTO). The idea is that browser
> implementors can open the testcase, and trivially conclude "my
> behavior is correct / incorrect".
>
>     Some things that need to be covered by testcases:
>
>     - Clarify order: X3D file with FontLibrary node A, than shape B
> using a font, then another FontLibrary C. Show unambiguously whether
> interpreting B is affected by C or not. In case A and C define the
> same family names.
>

And even simpler: Without a FontLibrary A, is Shape B before FontLibrary C
expected to work, eg. render with the font in C ?
Presumably no, following the DEF before USE pattern.


>     - Show the case of IMPORTing a FontLibrary from Inline. I guess
> the IMPORTed FontLibrary node should be searched, as if it was part of
> the top-level file?
>

Again, should Shape before IMPORT ExportedFontLibraryDEFname work ?
Presumably no, for consistency with above.


>
>     - Testcases of the font collections, with multiple fonts, with
> multiple styles.
>
>      - Show what happens when a font family is found within some
> FontLibrary, but not with a matching style. Do not leave it in the
> spec undefined. Remember that browsers in general cannot "synthesize
> the missing style", we agreed in this thread that this is both a
> difficult thing and the results have poor quality. So the spec (and
> testcases) should qualify what is the fallback then -- should we use
> another style from the same family? Should we fallback from font
> family "foo", style "italic" -> font family "foo", style "regular"?
> And the reverse, should the font family "foo", style "regular" ->
> fallback on "foo", style "italic" (if only the latter is available)?
> Or should it fallback on the browser default font?
>

My understanding is that the current language in the spec. only guarantees
matching if a FontLibrary.family name is provided. Otherwise, the results
are undefined although a browser is free to try its best by looking into
the font metadata (although that should be probably discouraged for more
consistent renderings).
I also think that MFString FontStyle.family fallbacks would still apply.
Eg. if there is no match, try the next family name. If nothing matches, use
"SERIF".

But there is a need to clarify if the FontStyle.style is used in matching,
and if yes, how it should be used. I would prefer if the FontStyle.style
field is only used for system fonts (eg. no change to current behaviour),
and completely ignored for FontLibrary provided fonts (since in almost all
cases there is only one style in the file).

Andreas


> Regards,
> Michalis
>
> czw., 13 mar 2025 o 23:16 Andreas Plesch <andreasplesch at gmail.com>
> napisał(a):
> >
> > Thanks for further careful consideration and adjustments. Hopefully, it
> is not too late to add to the discussion further.
> >
> > If support of font collection files which contain multiple fonts is
> required for full compliance, it will be important to a) show a concrete
> test case perhaps with an Asian font which implementations can target and
> b) fully define how the selection of the desired font out of the multiple
> fonts in the file should be accomplished, eg. perhaps by an indexed order
> in the file, or by one of the font family names ("full name") in the
> metadata, or by another mechanism like fuzzy matching.
> >
> > Thus, please consider that support for font collections is explicitly
> made optional, or only guaranteed at a higher component level.
> >
> > Second, in summary of the below, let me also suggest that font names,
> sourced from the family field or from metadata, become name scoped to allow
> for separation of Inlines, and ProtoInstances.
> >
> > Third, is ordering important ? Can a FontStyle node only occur after a
> FontLibray node it references (similar to USE after DEF) ?
> >
> > Fuller discussion:
> >
> > With the emphasis of the FontLibray.family field over the optional
> lookup of a font family name in the metadata of the font file, a global
> scope of FontLibray is more attractive. The way the global scope is
> intended to be clearly expressed may not quite succeed:
> >
> > "Fonts from FontLibrary nodes are also usable when defined within an
> Inline node"
> >
> > probably means that if an Inline node has a font defined in a
> FontLibrary root node within it, it is usable also in the parent node. But
> I think this is the opposite of the iframe case, so the sentence may
> actually mean the opposite ?
> >
> > In any case, the way x3dom would probably handle a global/model wide
> FontLibrary scope is in two steps. First, whenever a FontLibrary node is
> encountered, register/add the defined font to the master document/model.
> This would be true even if encountered in an Inline or ProtoInstance. Then,
> when a FontStyle references the font by a matching family name, load the
> font which may or may not include downloading and then use it for
> rendering. This would be also true any time and even if encountered in an
> Inline or ProtoInstance.
> >
> > This has the effect that the order in which FontLibrary nodes are
> encountered is important. I think the order would probably play a role in
> any scenario. In addition this procedure also means that font family names
> would probably be name scoped to prevent leaking, similar to DEF/USE names.
> A font family name then can only be used for matching within the same name
> scope, eg. names can never match across name scopes.
> >
> > So a parent could not impact a child's font handling and vice versa.
> This complete separation would closely resemble the iframe separation which
> occurs also in both directions.
> >
> > Finally, I still have my doubts that these are not complications which
> only appear to be a simpler and more elegant match for font resource
> handling but are actually harder to understand and ultimately unnecessary.
> >
> > Any feedback or thoughts appreciated,
> >
> > Andreas Plesch
> > Waltham, MA 02453
> >
> > On Thu, Mar 13, 2025, 1:12 PM Brutzman, Donald (Don) (CIV) <
> brutzman at nps.edu> wrote:
> >>
> >> Holger, thanks for these carefully expressed points, very convincing.
> Also thanks to others for steadily progressing dialog on this topic.
> >>
> >> Dick and I met yesterday and looked closely at how to express "scene
> scope" satisfactorily.
> >>
> >> X3D 4.1 (draft) Architecture, clause 15 Text component, 15.4.1
> FontLibrary
> >>
> https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4.1-CD//Part01/components/text.html#FontLibrary
> >>
> >>
> >> Summary of latest revision follows.  (color-code reminder: yellow is
> proposed, cyan is editors note)
> >>
> >> FontLibrary family field is an important addition that resolves several
> challenges, we are ready to accept it.
> >>
> >> Current node definition:
> >>
> >> The FontLibrary node specifies a collection of one or more font family
> definitions. A font family may include one or more related font style
> definitions. FontLibrary provides the ability to selectively load font
> files for use by FontStyle and ScreenFontStyle nodes.
> >>
> >>
> >> Proposed addition:
> >>
> >> The visibility of FontLibrary fonts is scoped to the current model, and
> FontLibrary nodes are typically defined with other root nodes in a scene.
> Fonts from FontLibrary nodes are also usable when defined within an Inline
> node, or when defined among the topmost nodes of a Prototype instance
> contained in a scene.
> >>
> >>
> >> Keeping track of design rationale, we combined several thoughts as
> follows.
> >>
> >> Editors note:  key questions are
> >>
> >> Whether global scope is needed for FontLibrary fonts, rather than just
> within a FontStyle node; we think yes, fonts ought to have scene scope for
> the current model.
> >> If fonts are visible throughout a given model, then scoping a
> FontLibrary node within a FontStyle fontLibrary field appears to be
> superfluous. This avoids much unnecessary complication, especially if an
> author simply wants to change the value of a FontStyle family field.
> >> Whether a single font file contains more than one font; yes, various
> specifications indicate that may occur for some font files.
> >> Whether a browser might look inside the font file to check internal
> metadata and find one of multiple family names; yes that option seems like
> a good idea if no common matching family field is found for the FontStyle
> and FontLibrary nodes.
> >>
> >>
> >> Subject to group scrutiny and discussion, we are ready to
> >>
> >>
> >> Remove Example 2
> >>
> >> Editors note: the fontLibrary fields shown in EXAMPLE 2 appear to be an
> unnecessary complication, since the approach shown in Example 1 can also
> work for each of these two scene fragments. Subject to mailing list
> discussion, we expect to delete both fragments in EXAMPLE 2.
> >>
> >>
> >> Remove the corresponding FontStyle fontLibrary field in 15.4.2 FontStyle
> >>
> >>
> >> Hopefully we haven't overlooked reconciliation of any of the many prior
> discussion points.  Continued scrutiny and discussion remain welcome.
> >>
> >> Feels like we are getting close to an excellent design balance.
> Hopefully others feel that way too.
> >>
> >> Have fun with fonts in 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: x3d-public <x3d-public-bounces at web3d.org> on behalf of Holger
> Seelig via x3d-public <x3d-public at web3d.org>
> >> Sent: Friday, March 7, 2025 2:42 PM
> >> To: X3D <x3d-public at web3d.org>
> >> Cc: Holger Seelig <holger.seelig at yahoo.de>; Andreas Plesch <
> andreasplesch at gmail.com>
> >> Subject: Re: [x3d-public] draft X3D 4.1 prose for font files and
> libraries
> >>
> >> I think a FontLibrary should be scene scoped and no more. An Inline
> scene should not have access to the parent scenes FontLibrary nodes
> registers fonts (via FontLibrary.family field).
> >>
> >> In HTML there is a iframe element, the document in this element can’t
> get access to the parent document, It is completely separated. One reason
> is that an iframe is often used for advertising which comes often from a
> different provider and the advertising document should not have access to
> the parent document for security reasons.
> >>
> >> I also think that FontStyle.fontLibrary is not necessary. It makes the
> code more readable if FontLibrary is a root node.
> >>
> >> Best regards,
> >> Holger
> >>
> >> --
> >> Holger Seelig
> >> Leipzig, Germany
> >>
> >> holger.seelig at yahoo.de
> >> https://create3000.github.io/x_ite/
> >>
> >> Am 07.03.2025 um 21:13 schrieb John Carlson via x3d-public <
> x3d-public at web3d.org>:
> >>
> >>
> >>
> >> On Fri, Mar 7, 2025 at 1:33 PM Brutzman, Donald (Don) (CIV) via
> x3d-public <x3d-public at web3d.org> wrote:
> >>
> >> separation of concerns, i.e. keeping url networking separate from
> FontStyle presentation,  not overwhelming FontStyle functionality.  Thus,
> FontStyle.url is simply incomplete design, and FontStyle.fontLibrary is a
> more-correct alternative, if we want font scope limited to a single
> FontStyle node.
> >>
> >>
> >> I don't understand why the same argument doesn't also apply to
> ImageTexture.  I'm not seeing ImageTexture.url networking separate from
> ImageTexture presentation?  Do we need an ImageLibrary?
> >>
> >> John
> >> _______________________________________________
> >> x3d-public mailing list
> >> x3d-public at web3d.org
> >> http://web3d.org/mailman/listinfo/x3d-public_web3d.org
> >>
> >>
>


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


More information about the x3d-public mailing list