FontFaceSet.idl 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #import <CSS/FontFace.idl>
  2. dictionary FontFaceSetLoadEventInit : EventInit {
  3. sequence<FontFace> fontfaces = [];
  4. };
  5. // FIXME
  6. // [Exposed=(Window,Worker)]
  7. //interface FontFaceSetLoadEvent : Event {
  8. // constructor(CSSOMString type, optional FontFaceSetLoadEventInit eventInitDict = {});
  9. // [SameObject] readonly attribute FrozenArray<FontFace> fontfaces;
  10. //};
  11. enum FontFaceSetLoadStatus { "loading", "loaded" };
  12. // https://drafts.csswg.org/css-font-loading/#fontfaceset
  13. [Exposed=(Window,Worker)]
  14. interface FontFaceSet : EventTarget {
  15. constructor(sequence<FontFace> initialFaces);
  16. setlike<FontFace>;
  17. FontFaceSet add(FontFace font);
  18. boolean delete(FontFace font);
  19. undefined clear();
  20. // events for when loading state changes
  21. [FIXME] attribute EventHandler onloading;
  22. [FIXME] attribute EventHandler onloadingdone;
  23. [FIXME] attribute EventHandler onloadingerror;
  24. // check and start loads if appropriate
  25. // and fulfill promise when all loads complete
  26. // FIXME: Promise<sequence<FontFace>> load(CSSOMString font, optional CSSOMString text = " ");
  27. Promise<sequence<FontFace>> load(CSSOMString font, optional CSSOMString text = "");
  28. // return whether all fonts in the fontlist are loaded
  29. // (does not initiate load if not available)
  30. // FIXME: boolean check(CSSOMString font, optional CSSOMString text = " ");
  31. [FIXME] boolean check(CSSOMString font, optional CSSOMString text = "");
  32. // async notification that font loading and layout operations are done
  33. readonly attribute Promise<FontFaceSet> ready;
  34. // loading state, "loading" while one or more fonts loading, "loaded" otherwise
  35. readonly attribute FontFaceSetLoadStatus status;
  36. };
  37. interface mixin FontFaceSource {
  38. readonly attribute FontFaceSet fonts;
  39. };