Skip to content

Truly independent web browser

LibGfx: Remove the C++ table of supported font technologies

Aliaksandr Kalenik0741598d3eaf
diff --git a/Libraries/LibGfx/Font/FontSupport.cpp b/Libraries/LibGfx/Font/FontSupport.cpp
index f6113dcd10b..63d5be26780 100644
--- a/Libraries/LibGfx/Font/FontSupport.cpp
+++ b/Libraries/LibGfx/Font/FontSupport.cpp
@@ -6,8 +6,6 @@
#include <LibGfx/Font/FontSupport.h>
-#include <harfbuzz/hb.h>
-
namespace Gfx {
bool font_format_is_supported(FontFormat const format)
@@ -33,52 +31,4 @@ bool font_format_is_supported(FontFormat const format)
return false;
}
-bool font_tech_is_supported(FontTech const font_tech)
-{
- // https://drafts.csswg.org/css-fonts-4/#font-tech-definitions
- // FIXME: Determine these automatically.
- switch (font_tech) {
- case FontTech::FeaturesOpentype:
- // GSUB and GPOS, supported by HarfBuzz
- return true;
- case FontTech::FeaturesAat:
- // morx and kerx, supported by HarfBuzz
- return true;
- case FontTech::FeaturesGraphite:
- // Silf, Glat , Gloc , Feat and Sill. HarfBuzz may or may not be built with support for it.
-#if HB_HAS_GRAPHITE
- return true;
-#else
- return false;
-#endif
- case FontTech::Variations:
- // avar, cvar, fvar, gvar, HVAR, MVAR, STAT, and VVAR, supported by HarfBuzz
- return true;
- case FontTech::ColorColrv0:
- case FontTech::ColorColrv1:
- // COLR, supported by HarfBuzz
- return true;
- case FontTech::ColorSvg:
- // SVG, supported by HarfBuzz
- return true;
- case FontTech::ColorSbix:
- // sbix, supported by HarfBuzz
- return true;
- case FontTech::ColorCbdt:
- // CBDT, supported by HarfBuzz
- return true;
- case FontTech::Palettes:
- // CPAL, supported by HarfBuzz
- return true;
- case FontTech::Incremental:
- // Incremental Font Transfer: https://w3c.github.io/IFT/Overview.html
- return false;
- // https://drafts.csswg.org/css-fonts-5/#font-tech-definitions
- case FontTech::Avar2:
- // avar version 2, supported by HarfBuzz
- return true;
- }
- return false;
-}
-
}
diff --git a/Libraries/LibGfx/Font/FontSupport.h b/Libraries/LibGfx/Font/FontSupport.h
index e9b08b134da..fd2134fed54 100644
--- a/Libraries/LibGfx/Font/FontSupport.h
+++ b/Libraries/LibGfx/Font/FontSupport.h
@@ -20,22 +20,6 @@ enum class FontFormat : u8 {
WOFF2,
};
-enum class FontTech : u8 {
- Avar2,
- ColorCbdt,
- ColorColrv0,
- ColorColrv1,
- ColorSbix,
- ColorSvg,
- FeaturesAat,
- FeaturesGraphite,
- FeaturesOpentype,
- Incremental,
- Palettes,
- Variations,
-};
-
bool font_format_is_supported(FontFormat);
-bool font_tech_is_supported(FontTech);
}
diff --git a/Libraries/LibWeb/Rust/src/css/parser/fonts_parser.rs b/Libraries/LibWeb/Rust/src/css/parser/fonts_parser.rs
index 6ec0a0fb104..5fbe4c5bece 100644
--- a/Libraries/LibWeb/Rust/src/css/parser/fonts_parser.rs
+++ b/Libraries/LibWeb/Rust/src/css/parser/fonts_parser.rs
@@ -39,8 +39,8 @@ const FONT_FORMAT_SUPPORT: &[(&str, bool)] = &[
("woff2", true),
];
-// NB: Mirrors Libraries/LibGfx/Font/FontSupport.cpp:36. Its HB_HAS_GRAPHITE branch is false because
-// vcpkg.json does not enable HarfBuzz's optional Graphite support on any supported platform.
+// NB: HarfBuzz reads every font technology but incremental transfer, and Graphite, which vcpkg.json
+// does not enable on any supported platform.
const FONT_TECH_SUPPORT: [bool; font_tech::NAMES.len()] = [
true, // avar2
true, // color-cbdt