FontFaceSet.idl 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #import <CSS/FontFace.idl>
  2. #import <DOM/EventTarget.idl>
  3. dictionary FontFaceSetLoadEventInit : EventInit {
  4. sequence<FontFace> fontfaces = [];
  5. };
  6. // FIXME
  7. // [Exposed=(Window,Worker)]
  8. //interface FontFaceSetLoadEvent : Event {
  9. // constructor(CSSOMString type, optional FontFaceSetLoadEventInit eventInitDict = {});
  10. // [SameObject] readonly attribute FrozenArray<FontFace> fontfaces;
  11. //};
  12. enum FontFaceSetLoadStatus { "loading", "loaded" };
  13. // https://drafts.csswg.org/css-font-loading/#fontfaceset
  14. [Exposed=(Window,Worker)]
  15. interface FontFaceSet : EventTarget {
  16. setlike<FontFace>;
  17. FontFaceSet add(FontFace font);
  18. boolean delete(FontFace font);
  19. undefined clear();
  20. // events for when loading state changes
  21. attribute EventHandler onloading;
  22. attribute EventHandler onloadingdone;
  23. 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. };