FontFaceSet.idl 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. constructor(sequence<FontFace> initialFaces);
  17. setlike<FontFace>;
  18. FontFaceSet add(FontFace font);
  19. boolean delete(FontFace font);
  20. undefined clear();
  21. // events for when loading state changes
  22. attribute EventHandler onloading;
  23. attribute EventHandler onloadingdone;
  24. attribute EventHandler onloadingerror;
  25. // check and start loads if appropriate
  26. // and fulfill promise when all loads complete
  27. // FIXME: Promise<sequence<FontFace>> load(CSSOMString font, optional CSSOMString text = " ");
  28. Promise<sequence<FontFace>> load(CSSOMString font, optional CSSOMString text = "");
  29. // return whether all fonts in the fontlist are loaded
  30. // (does not initiate load if not available)
  31. // FIXME: boolean check(CSSOMString font, optional CSSOMString text = " ");
  32. [FIXME] boolean check(CSSOMString font, optional CSSOMString text = "");
  33. // async notification that font loading and layout operations are done
  34. readonly attribute Promise<FontFaceSet> ready;
  35. // loading state, "loading" while one or more fonts loading, "loaded" otherwise
  36. readonly attribute FontFaceSetLoadStatus status;
  37. };
  38. interface mixin FontFaceSource {
  39. readonly attribute FontFaceSet fonts;
  40. };