FontFace.h 989 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/FlyString.h>
  8. #include <AK/URL.h>
  9. #include <LibWeb/CSS/UnicodeRange.h>
  10. namespace Web::CSS {
  11. class FontFace {
  12. public:
  13. struct Source {
  14. AK::URL url;
  15. // FIXME: Do we need to keep this around, or is it only needed to discard unwanted formats during parsing?
  16. Optional<FlyString> format;
  17. };
  18. FontFace(FlyString font_family, Vector<Source> sources, Vector<UnicodeRange> unicode_ranges);
  19. ~FontFace() = default;
  20. FlyString font_family() const { return m_font_family; }
  21. Vector<Source> const& sources() const { return m_sources; }
  22. Vector<UnicodeRange> const& unicode_ranges() const { return m_unicode_ranges; }
  23. // FIXME: font-style, font-weight, font-stretch, font-feature-settings
  24. private:
  25. FlyString m_font_family;
  26. Vector<Source> m_sources;
  27. Vector<UnicodeRange> m_unicode_ranges;
  28. };
  29. }