Skip to content

implement a wrapper of CSS Font Loading API #1833

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mesmerizingwaft
Copy link

Summary

This PR partially adds a wrapper of CSS Font Loading API

This PR includes:

  • css_font_load.ml(i) : actual implementation of the wrapper
  • adding a property fonts to Dom_html.document to return FontFaceSet
  • examples/css_font_load

Note

  1. Hi. This is my first PR on this repo. Let me know if anything is missing in this PR.

  2. I didn't include a test for this feature because it seems the font loading API is not working on test codes in a straightforward manner (which may require stub or something of FontFaceSet)
    Do you guys have any idea to handle this?

@hhugo hhugo force-pushed the css_font_load branch from e6a1f0b to 3b3a737 Compare May 9, 2025 08:07
@hhugo hhugo self-assigned this May 23, 2025
@hhugo
Copy link
Member

hhugo commented Jun 20, 2025

it seems the font loading API is not working on test codes in a straightforward manner (which may require stub or something of FontFaceSet)

I don't understand this. What's missing for this to work ?


method load : unit -> 'a meth

method ready : bool readonly_prop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ready should return a promise


method display : js_string t readonly_prop

method src : js_string t readonly_prop
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this documented ?

method status : js_string t readonly_prop
end

val create_font_face : js_string t -> js_string t -> fontFaceElement t
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we allow users to provide an optional descriptors as defined in https://developer.mozilla.org/en-US/docs/Web/API/FontFace/FontFace ?

@hhugo
Copy link
Member

hhugo commented Jun 20, 2025

It would help to have #2031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants