FontFaceSet.idl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. // async notification that font loading and layout operations are done
  32. readonly attribute Promise<FontFaceSet> ready;
  33. // loading state, "loading" while one or more fonts loading, "loaded" otherwise
  34. readonly attribute FontFaceSetLoadStatus status;
  35. };
  36. interface mixin FontFaceSource {
  37. readonly attribute FontFaceSet fonts;
  38. };