Skip to content

Truly independent web browser

LibGfx+LibWeb: Synthesize bold and oblique a font face lacks

sideshowbarkerc3b937a906d3
diff --git a/Libraries/LibGfx/Font/FaceDescription.h b/Libraries/LibGfx/Font/FaceDescription.h
index 781e9aaa770..b492901bd14 100644
--- a/Libraries/LibGfx/Font/FaceDescription.h
+++ b/Libraries/LibGfx/Font/FaceDescription.h
@@ -44,6 +44,12 @@ public:
// The style of the face with these variations applied.
FaceStyle style_for_variations(ReadonlySpan<FontVariationAxis>) const;
+ // Whether the face has a variation axis with this tag.
+ bool has_axis(u32 tag) const
+ {
+ return m_axes.contains([&](auto const& axis) { return axis.tag == tag; });
+ }
+
private:
struct VariationAxis {
u32 tag { 0 };
diff --git a/Libraries/LibGfx/Font/Typeface.cpp b/Libraries/LibGfx/Font/Typeface.cpp
index 76902d5b836..cfa0dda66c1 100644
--- a/Libraries/LibGfx/Font/Typeface.cpp
+++ b/Libraries/LibGfx/Font/Typeface.cpp
@@ -475,6 +475,24 @@ FaceDescription const& Typeface::description() const
return *m_description;
}
+// NB: A slant of 90 degrees has an infinite skew, so a synthetic oblique stops just short of it.
+static constexpr float max_synthetic_oblique_angle = 89;
+
+FontSynthesis Typeface::synthesis_for(FontSynthesisRequest const& request, FontVariationSettings const& variations) const
+{
+ auto style = style_for_variations(variations.to_sorted_list());
+ FontSynthesis synthesis;
+ // A face that is lighter than bold is drawn bolder for a bold request. A variable face whose weight axis stops
+ // short of the weight asked for is drawn at the end of its axis instead, as its designer made it.
+ if (request.allows_weight && request.weight >= 600 && style.weight < 600 && !description().has_axis(FourCC("wght").to_u32()))
+ synthesis.bold = true;
+ // An upright face is slanted for an italic or oblique request, unless its axes give it a slant of its own.
+ if (request.allows_style && request.slope != 0 && style.slope == 0
+ && !description().has_axis(FourCC("ital").to_u32()) && !description().has_axis(FourCC("slnt").to_u32()))
+ synthesis.oblique_angle = clamp(request.oblique_angle, -max_synthetic_oblique_angle, max_synthetic_oblique_angle);
+ return synthesis;
+}
+
FaceStyle Typeface::style_for_variations(ReadonlySpan<FontVariationAxis> variations) const
{
if (auto style = fixed_style(); style.has_value())
diff --git a/Libraries/LibGfx/Font/Typeface.h b/Libraries/LibGfx/Font/Typeface.h
index 9869d0ae89c..cda8e6a4a70 100644
--- a/Libraries/LibGfx/Font/Typeface.h
+++ b/Libraries/LibGfx/Font/Typeface.h
@@ -67,6 +67,19 @@ struct FontSynthesis {
bool operator==(FontSynthesis const&) const = default;
};
+// https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight
+// https://drafts.csswg.org/css-fonts-4/#font-synthesis-style
+// What a request for text at this weight and slope (0 normal, 1 italic, 2 oblique) asks to be synthesized of a font
+// made of the typeface with these variations, where the request allows synthesis of weight and of style.
+struct FontSynthesisRequest {
+ int weight { 400 };
+ int slope { 0 };
+ // The angle of the oblique style the request asks for, in degrees.
+ float oblique_angle { 14 };
+ bool allows_weight { true };
+ bool allows_style { true };
+};
+
struct FontCacheKey {
float point_size;
Vector<FontVariationAxis> axes;
@@ -146,6 +159,10 @@ public:
hb_face_t* harfbuzz_typeface() const;
FaceDescription const& description() const;
+ // How a font of this typeface, with these variations, has to be synthesized to show the weight and the slope that
+ // the request asks for.
+ FontSynthesis synthesis_for(FontSynthesisRequest const&, FontVariationSettings const&) const;
+
// The style of a font of this typeface with these variations.
FaceStyle style_for_variations(ReadonlySpan<FontVariationAxis>) const;
ErrorOr<Vector<String>> local_font_names() const;
diff --git a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp
index b09dc4e8438..cb20930da1a 100644
--- a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp
+++ b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.cpp
@@ -13,6 +13,7 @@
#include <LibWeb/CSS/FontComputer.h>
#include <LibWeb/CSS/FontResolution.h>
#include <LibWeb/CSS/StyleSheetState.h>
+#include <LibWeb/CSS/StyleValues/AngleStyleValue.h>
#include <LibWeb/CSS/StyleValues/ColorSchemeStyleValue.h>
#include <LibWeb/CSS/StyleValues/ColorStyleValue.h>
#include <LibWeb/CSS/StyleValues/CounterStyleStyleValue.h>
@@ -29,6 +30,7 @@
#include <LibWeb/CSS/StyleValues/StringStyleValue.h>
#include <LibWeb/CSS/StyleValues/StyleValueList.h>
#include <LibWeb/DOM/Document.h>
+#include <LibWeb/StyleEngineRustFFI.h>
#include <LibWebCommon/CSS/SystemColor.h>
namespace Web::CSS {
@@ -454,6 +456,8 @@ ValueComparingNonnullRefPtr<Gfx::FontCascadeList const> ComputedStyleWorkingSet:
.font_width = font_width(),
.feature_values = font_resolution_feature_values(),
.font_feature_values_scope = tree_scope,
+ .font_oblique_angle = font_oblique_angle(),
+ .font_synthesis = font_synthesis(),
});
m_cached_computed_font_list_scope = tree_scope;
VERIFY(!m_cached_computed_font_list->is_empty());
@@ -528,6 +532,33 @@ Percentage ComputedStyleWorkingSet::font_width() const
return Percentage { StyleValueFFI::rust_style_value_computed_percentage(effective_property_data(PropertyID::FontWidth)) };
}
+// https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle
+// "The lack of an <angle> represents 14deg."
+double ComputedStyleWorkingSet::font_oblique_angle() const
+{
+ auto const& font_style = property(PropertyID::FontStyle).as_font_style();
+ if (font_style.font_style() != FontStyleKeyword::Oblique)
+ return 14;
+ auto angle = font_style.angle();
+ if (!angle || !angle->is_angle())
+ return 14;
+ return angle->as_angle().angle().to_degrees();
+}
+
+// Which synthesis the font-synthesis longhands forbid, in the encoding of the style engine's font resolution requests.
+u8 ComputedStyleWorkingSet::font_synthesis() const
+{
+ u8 synthesis = 0;
+ if (property(PropertyID::FontSynthesisWeight).to_keyword() == Keyword::None)
+ synthesis |= StyleEngineFFI::FONT_SYNTHESIS_NO_WEIGHT;
+ auto style = property(PropertyID::FontSynthesisStyle).to_keyword();
+ if (style == Keyword::None)
+ synthesis |= StyleEngineFFI::FONT_SYNTHESIS_STYLE_NONE << StyleEngineFFI::FONT_SYNTHESIS_STYLE_SHIFT;
+ else if (style == Keyword::ObliqueOnly)
+ synthesis |= StyleEngineFFI::FONT_SYNTHESIS_STYLE_OBLIQUE_ONLY << StyleEngineFFI::FONT_SYNTHESIS_STYLE_SHIFT;
+ return synthesis;
+}
+
int ComputedStyleWorkingSet::font_slope() const
{
return property(PropertyID::FontStyle).as_font_style().to_font_slope();
diff --git a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h
index bcc75cbf355..da209b9f3f1 100644
--- a/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h
+++ b/Libraries/LibWeb/CSS/ComputedStyleWorkingSet.h
@@ -119,6 +119,8 @@ private:
double font_weight() const;
Percentage font_width() const;
int font_slope() const;
+ double font_oblique_angle() const;
+ u8 font_synthesis() const;
ComputedValuesFFI::FfiComputedStyleMetadata& metadata() { return m_metadata; }
ComputedValuesFFI::FfiComputedStyleMetadata const& metadata() const { return m_metadata; }
void clear_computed_font_list_cache()
diff --git a/Libraries/LibWeb/CSS/FontComputer.h b/Libraries/LibWeb/CSS/FontComputer.h
index be4289fedb3..c603a38a08c 100644
--- a/Libraries/LibWeb/CSS/FontComputer.h
+++ b/Libraries/LibWeb/CSS/FontComputer.h
@@ -112,6 +112,10 @@ struct ComputedFontCacheKey {
// The tree scope whose @font-feature-values the request reads, or the document's when its
// font-variant-alternates name no feature values, so that alike requests share one answer.
TreeScopeID font_feature_values_scope;
+ // The angle of the oblique style font-style asks for, in degrees.
+ double font_oblique_angle { 14 };
+ // Which synthesis the font-synthesis longhands forbid, as the style engine encodes it.
+ u8 font_synthesis { 0 };
[[nodiscard]] bool operator==(ComputedFontCacheKey const& other) const = default;
};
diff --git a/Libraries/LibWeb/CSS/FontResolution.cpp b/Libraries/LibWeb/CSS/FontResolution.cpp
index 796a90ad02b..d061d6c8951 100644
--- a/Libraries/LibWeb/CSS/FontResolution.cpp
+++ b/Libraries/LibWeb/CSS/FontResolution.cpp
@@ -79,24 +79,37 @@ static Optional<Gfx::SystemUIFontKind> macos_system_ui_font_kind_from_family_nam
}
#endif
+// https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight
+// How a face of the snapshot registered under `key` is synthesized for the request: never bolder where its font-weight
+// descriptor claims bold weights, nor slanted where its font-style descriptor claims a slant, whatever its file holds.
+static Gfx::FontSynthesis synthesis_for_face(FontFaceSnapshot::Face const& face, FontFaceKey const& key, Gfx::Typeface const& typeface, Gfx::FontSynthesisRequest const& request, Gfx::FontVariationSettings const& variations)
+{
+ auto synthesis = typeface.synthesis_for(request, variations);
+ if (!face.weight_descriptor_is_auto && key.weight.max >= 600)
+ synthesis.bold = false;
+ if (key.slope != 0)
+ synthesis.oblique_angle = 0;
+ return synthesis;
+}
+
// What one face of the snapshot renders with. A face still waiting on its load becomes a pending entry: a cascade is
// frozen and laid out on whichever thread resolves it, so the entry reads the snapshot and the typeface the face
// publishes, and only selecting it for a rendered code point, on the document thread, reaches the face, by its number
// through the document's registry.
-static RefPtr<Gfx::FontCascadeList const> font_for_face(FontFaceSnapshot::Face const& face, float point_size, Gfx::FontVariationSettings const& variations, Gfx::ShapeFeatures const& shape_features)
+static RefPtr<Gfx::FontCascadeList const> font_for_face(FontFaceSnapshot::Face const& face, FontFaceKey const& key, float point_size, Gfx::FontVariationSettings const& variations, Gfx::ShapeFeatures const& shape_features, Gfx::FontSynthesisRequest const& synthesis_request)
{
if (face.is_unusable)
return {};
auto font_list = Gfx::FontCascadeList::create();
if (face.typeface) {
- font_list->add(face.typeface->font(point_size, variations, shape_features), face.unicode_ranges);
+ font_list->add(face.typeface->font(point_size, variations, shape_features, synthesis_for_face(face, key, *face.typeface, synthesis_request, variations)), face.unicode_ranges);
} else if (face.has_urls) {
font_list->add_pending_face(face.unicode_ranges, [face_id = face.id] {
if (auto face = FontFaceState::with_id(face_id))
return face->resolve_for_rendering();
- return Gfx::PendingFontState::Failed; }, [rendering_typeface = face.rendering_typeface, point_size, variations, shape_features]() -> RefPtr<Gfx::Font const> {
+ return Gfx::PendingFontState::Failed; }, [face, key, rendering_typeface = face.rendering_typeface, point_size, variations, shape_features, synthesis_request]() -> RefPtr<Gfx::Font const> {
if (auto typeface = rendering_typeface->get())
- return typeface->font(point_size, variations, shape_features);
+ return typeface->font(point_size, variations, shape_features, synthesis_for_face(face, key, *typeface, synthesis_request, variations));
return {}; }, [state = face.rendering_state] { return state; }, face.id);
}
if (font_list->is_empty())
@@ -145,11 +158,11 @@ struct MatchingFontCandidate {
unsigned width { Gfx::FontWidth::Normal };
Gfx::Typeface const* system_typeface { nullptr };
- [[nodiscard]] RefPtr<Gfx::FontCascadeList const> font_with_point_size(FontFaceSnapshot const& snapshot, float point_size, Gfx::FontVariationSettings const& variations, WeightAxisFollowsFontWeight weight_axis_follows_font_weight, Gfx::ShapeFeatures const& shape_features) const
+ [[nodiscard]] RefPtr<Gfx::FontCascadeList const> font_with_point_size(FontFaceSnapshot const& snapshot, float point_size, Gfx::FontVariationSettings const& variations, WeightAxisFollowsFontWeight weight_axis_follows_font_weight, Gfx::ShapeFeatures const& shape_features, Gfx::FontSynthesisRequest const& synthesis_request) const
{
if (system_typeface) {
auto font_list = Gfx::FontCascadeList::create();
- font_list->add(system_typeface->font(point_size, variations, shape_features));
+ font_list->add(system_typeface->font(point_size, variations, shape_features, system_typeface->synthesis_for(synthesis_request, variations)));
return font_list;
}
@@ -170,7 +183,7 @@ struct MatchingFontCandidate {
// afterwards, and does nothing for a face past "unloaded" already.
if (face.has_urls && !face.has_non_default_unicode_range)
note_wanted_web_face(face.id);
- if (auto face_fonts = font_for_face(face, point_size, variations_for_face(face, variations, clamped_variations), shape_features)) {
+ if (auto face_fonts = font_for_face(face, key, point_size, variations_for_face(face, variations, clamped_variations), shape_features, synthesis_request)) {
font_list->extend(*face_fonts);
continue;
}
@@ -192,7 +205,7 @@ struct MatchingFontCandidate {
// Partial implementation of the font-matching algorithm: https://www.w3.org/TR/css-fonts-4/#font-matching-algorithm
// FIXME: This should be replaced by the full CSS font selection algorithm.
-static RefPtr<Gfx::FontCascadeList const> font_matching_algorithm(FontFaceSnapshot const& snapshot, Utf16FlyString const& family_name, int weight, Percentage const& font_width, int slope, float font_size_in_pt, Gfx::FontVariationSettings const& variations, WeightAxisFollowsFontWeight weight_axis_follows_font_weight, Gfx::ShapeFeatures const& shape_features)
+static RefPtr<Gfx::FontCascadeList const> font_matching_algorithm(FontFaceSnapshot const& snapshot, Utf16FlyString const& family_name, int weight, Percentage const& font_width, int slope, float font_size_in_pt, Gfx::FontVariationSettings const& variations, WeightAxisFollowsFontWeight weight_axis_follows_font_weight, Gfx::ShapeFeatures const& shape_features, Gfx::FontSynthesisRequest const& synthesis_request)
{
// If a font family match occurs, the user agent assembles the set of font faces in that family and then
// narrows the set to a single face using other font properties in the order given below.
@@ -229,7 +242,7 @@ static RefPtr<Gfx::FontCascadeList const> font_matching_algorithm(FontFaceSnapsh
order.resize(matching_family_fonts.size());
auto order_length = Parser::ValueParserFFI::rust_font_matching_order(weighed_candidates.span(), weight, font_width_bucket_from_percentage(font_width.value()), slope, order.span());
for (auto index : order.span().trim(order_length)) {
- if (auto found_font = matching_family_fonts[index].font_with_point_size(snapshot, font_size_in_pt, variations, weight_axis_follows_font_weight, shape_features))
+ if (auto found_font = matching_family_fonts[index].font_with_point_size(snapshot, font_size_in_pt, variations, weight_axis_follows_font_weight, shape_features, synthesis_request))
return found_font;
}
return {};
@@ -310,6 +323,18 @@ NonnullRefPtr<Gfx::FontCascadeList const> resolve_font_cascade(FontFaceSnapshot
// FIXME: We round to int here as that is what is expected by our font infrastructure below
auto weight = round_to<int>(font_weight);
+ // https://drafts.csswg.org/css-fonts-4/#font-synthesis-style
+ // "oblique-only: Synthesis of an oblique face is allowed when the requested style is oblique, but not when it is
+ // italic."
+ auto synthesis_style = (key.font_synthesis >> StyleEngineFFI::FONT_SYNTHESIS_STYLE_SHIFT) & 3;
+ Gfx::FontSynthesisRequest synthesis_request {
+ .weight = weight,
+ .slope = slope,
+ // NB: An italic request is synthesized with the default oblique angle.
+ .oblique_angle = slope == 2 ? static_cast<float>(key.font_oblique_angle) : 14.0f,
+ .allows_weight = !(key.font_synthesis & StyleEngineFFI::FONT_SYNTHESIS_NO_WEIGHT),
+ .allows_style = synthesis_style == 0 || (synthesis_style == StyleEngineFFI::FONT_SYNTHESIS_STYLE_OBLIQUE_ONLY && slope == 2),
+ };
// The size the lookups below select fonts at, which font-size-adjust can change for each family.
Gfx::FontVariationSettings variation;
@@ -393,7 +418,7 @@ NonnullRefPtr<Gfx::FontCascadeList const> resolve_font_cascade(FontFaceSnapshot
return {};
auto font_list = Gfx::FontCascadeList::create();
- font_list->add(typeface->font(font_size_in_pt, variation, shape_features));
+ font_list->add(typeface->font(font_size_in_pt, variation, shape_features, typeface->synthesis_for(synthesis_request, variation)));
return font_list;
};
#endif
@@ -413,7 +438,7 @@ NonnullRefPtr<Gfx::FontCascadeList const> resolve_font_cascade(FontFaceSnapshot
auto clamped_variations = variations_clamped_to_weight_descriptor(variation, weight_axis_follows_font_weight, lookup_key.weight);
auto result = Gfx::FontCascadeList::create();
for (auto const& face : *faces) {
- if (auto face_fonts = font_for_face(face, font_size_in_pt, variations_for_face(face, variation, clamped_variations), shape_features))
+ if (auto face_fonts = font_for_face(face, lookup_key, font_size_in_pt, variations_for_face(face, variation, clamped_variations), shape_features, synthesis_request))
result->extend(*face_fonts);
}
if (!result->is_empty())
@@ -429,7 +454,7 @@ NonnullRefPtr<Gfx::FontCascadeList const> resolve_font_cascade(FontFaceSnapshot
}
#endif
- if (auto found_font = font_matching_algorithm(snapshot, family, weight, font_width, slope, font_size_in_pt, variation, weight_axis_follows_font_weight, shape_features); found_font && !found_font->is_empty())
+ if (auto found_font = font_matching_algorithm(snapshot, family, weight, font_width, slope, font_size_in_pt, variation, weight_axis_follows_font_weight, shape_features, synthesis_request); found_font && !found_font->is_empty())
return found_font;
return {};
@@ -701,6 +726,8 @@ static StyleEngineFFI::FfiResolvedFont resolve_font_for_style_engine(void const*
.font_width = Percentage(request.font_width),
.feature_values = {},
.font_feature_values_scope = TreeScopeID { request.font_feature_values_scope },
+ .font_oblique_angle = request.font_oblique_angle,
+ .font_synthesis = request.font_synthesis,
};
if (request.font_size_adjust == StyleEngineFFI::FontSizeAdjustKind::Number)
key.font_size_adjust = FontSizeAdjust { static_cast<FontSizeAdjustMetric>(request.font_size_adjust_metric), request.font_size_adjust_value };
diff --git a/Libraries/LibWeb/CSS/FontResolution.h b/Libraries/LibWeb/CSS/FontResolution.h
index 1d4925de46e..e54915117f8 100644
--- a/Libraries/LibWeb/CSS/FontResolution.h
+++ b/Libraries/LibWeb/CSS/FontResolution.h
@@ -40,6 +40,7 @@ struct AK::Traits<Web::CSS::ComputedFontCacheKey> : public AK::DefaultTraits<Web
for (auto const& value : key.feature_values)
hash = pair_int_hash(hash, value ? 1 : 0);
hash = pair_int_hash(hash, key.font_feature_values_scope.value());
+ hash = pair_int_hash(hash, pair_int_hash(Traits<double>::hash(key.font_oblique_angle), key.font_synthesis));
return hash;
}
diff --git a/Libraries/LibWeb/CSS/PseudoElementPropertyGroups.txt b/Libraries/LibWeb/CSS/PseudoElementPropertyGroups.txt
index a9dedd4e13a..7b10c706122 100644
--- a/Libraries/LibWeb/CSS/PseudoElementPropertyGroups.txt
+++ b/Libraries/LibWeb/CSS/PseudoElementPropertyGroups.txt
@@ -90,7 +90,7 @@ custom
[font-properties]
# https://drafts.csswg.org/css-fonts/#property-index
-# FIXME: font-synthesis and longhands
+# FIXME: font-synthesis-small-caps and font-synthesis-position
font
font-family
font-feature-settings
@@ -101,6 +101,9 @@ font-palette
font-size
font-size-adjust
font-style
+font-synthesis
+font-synthesis-style
+font-synthesis-weight
font-variant
font-variant-alternates
font-variant-caps
diff --git a/Libraries/LibWeb/Rust/build.rs b/Libraries/LibWeb/Rust/build.rs
index f54d93a68e9..395a75fc4c3 100644
--- a/Libraries/LibWeb/Rust/build.rs
+++ b/Libraries/LibWeb/Rust/build.rs
@@ -889,6 +889,8 @@ fn generate_property_metadata(manifest_dir: &Path, out_dir: &Path) -> Result<(),
"font-size",
"font-size-adjust",
"font-style",
+ "font-synthesis-style",
+ "font-synthesis-weight",
"font-variant-alternates",
"font-variant-caps",
"font-variant-east-asian",
diff --git a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
index d21b5adbafd..9a6a7472383 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_value_types.rs
@@ -670,6 +670,8 @@ pub struct FontValues {
pub font_family: ComputedStyleValueHandle,
pub font_style: ComputedStyleValueHandle,
pub font_optical_sizing: ComputedStyleValueHandle,
+ pub font_synthesis_weight: ComputedStyleValueHandle,
+ pub font_synthesis_style: ComputedStyleValueHandle,
pub font_feature_settings: ComputedStyleValueHandle,
pub font_kerning: ComputedStyleValueHandle,
pub font_language_override: ComputedStyleValueHandle,
diff --git a/Libraries/LibWeb/Rust/src/css/computed_values.rs b/Libraries/LibWeb/Rust/src/css/computed_values.rs
index 46ebec192b1..ebf3013523d 100644
--- a/Libraries/LibWeb/Rust/src/css/computed_values.rs
+++ b/Libraries/LibWeb/Rust/src/css/computed_values.rs
@@ -608,6 +608,8 @@ impl Clone for FontValues {
font_family: self.font_family.clone(),
font_style: self.font_style.clone(),
font_optical_sizing: self.font_optical_sizing.clone(),
+ font_synthesis_weight: self.font_synthesis_weight.clone(),
+ font_synthesis_style: self.font_synthesis_style.clone(),
font_feature_settings: self.font_feature_settings.clone(),
font_kerning: self.font_kerning.clone(),
font_language_override: self.font_language_override.clone(),
@@ -652,6 +654,8 @@ impl PartialEq for FontValues {
&& self.font_family == other.font_family
&& self.font_style == other.font_style
&& self.font_optical_sizing == other.font_optical_sizing
+ && self.font_synthesis_weight == other.font_synthesis_weight
+ && self.font_synthesis_style == other.font_synthesis_style
&& self.font_feature_settings == other.font_feature_settings
&& self.font_kerning == other.font_kerning
&& self.font_language_override == other.font_language_override
@@ -4224,7 +4228,7 @@ const PAYLOAD_TYPED_LONGHANDS: [(u16, usize, usize, u8); 18] = {
/// The longhands whose computed value a handle of their group's payload holds as it is, by the
/// handle's offset: the group's values keep no second copy of them.
-const PAYLOAD_HANDLE_LONGHANDS: [(u16, usize, usize); 51] = {
+const PAYLOAD_HANDLE_LONGHANDS: [(u16, usize, usize); 53] = {
use crate::css::computed_value_types::{BackgroundValues, EffectsValues, FontValues, MaskValues, SVGResetValues};
use crate::css::property_metadata::property_id as p;
use std::mem::offset_of;
@@ -4321,6 +4325,16 @@ const PAYLOAD_HANDLE_LONGHANDS: [(u16, usize, usize); 51] = {
font,
offset_of!(FontValues, font_optical_sizing),
),
+ (
+ p::FONT_SYNTHESIS_WEIGHT,
+ font,
+ offset_of!(FontValues, font_synthesis_weight),
+ ),
+ (
+ p::FONT_SYNTHESIS_STYLE,
+ font,
+ offset_of!(FontValues, font_synthesis_style),
+ ),
(
p::FONT_FEATURE_SETTINGS,
font,
@@ -7202,6 +7216,8 @@ impl FontValues {
font_family: initial(property_id::FONT_FAMILY),
font_style: initial(property_id::FONT_STYLE),
font_optical_sizing: initial(property_id::FONT_OPTICAL_SIZING),
+ font_synthesis_weight: initial(property_id::FONT_SYNTHESIS_WEIGHT),
+ font_synthesis_style: initial(property_id::FONT_SYNTHESIS_STYLE),
font_feature_settings: initial(property_id::FONT_FEATURE_SETTINGS),
font_kerning: initial(property_id::FONT_KERNING),
font_language_override: initial(property_id::FONT_LANGUAGE_OVERRIDE),
diff --git a/Libraries/LibWeb/Rust/src/css/style/bridge.rs b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
index df2c6a6aa70..9837ba76650 100644
--- a/Libraries/LibWeb/Rust/src/css/style/bridge.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/bridge.rs
@@ -388,6 +388,12 @@ pub enum FontSizeAdjustKind {
pub const FONT_RESOLUTION_FEATURE_INPUT_COUNT: usize = 11;
const _: () = assert!(FontResolutionFeatureInput::TextRendering as usize + 1 == FONT_RESOLUTION_FEATURE_INPUT_COUNT);
+/// The bits of `FfiFontResolutionRequest::font_synthesis`.
+pub const FONT_SYNTHESIS_NO_WEIGHT: u8 = 1;
+pub const FONT_SYNTHESIS_STYLE_SHIFT: u8 = 1;
+pub const FONT_SYNTHESIS_STYLE_NONE: u8 = 1;
+pub const FONT_SYNTHESIS_STYLE_OBLIQUE_ONLY: u8 = 2;
+
#[repr(C)]
#[derive(Clone, Copy)]
pub struct FfiFontResolutionRequest {
@@ -401,6 +407,11 @@ pub struct FfiFontResolutionRequest {
pub font_weight: f64,
pub font_width: f64,
pub font_optical_sizing: u8,
+ /// The angle of the oblique style `font-style` asks for, in degrees: 14 for italic and for a bare `oblique`.
+ pub font_oblique_angle: f64,
+ /// Which synthesis the `font-synthesis` longhands forbid: `FONT_SYNTHESIS_NO_WEIGHT`, and the
+ /// `font-synthesis-style` value shifted by `FONT_SYNTHESIS_STYLE_SHIFT` (0 auto, 1 none, 2 oblique-only).
+ pub font_synthesis: u8,
/// The computed `font-size-adjust`: its kind, the metric it normalizes (a
/// `font_size_adjust_metric` value), and the number for `FontSizeAdjustKind::Number`. The
/// metric and number are zero for `FontSizeAdjustKind::None`.
diff --git a/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs b/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
index fe9279b31fb..eb0e01bab9b 100644
--- a/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/engine_sample.rs
@@ -1278,6 +1278,32 @@ pub(super) fn font_resolution_request<'a>(
},
_ => 0,
};
+ // https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle
+ // "The lack of an <angle> represents 14deg."
+ let font_oblique_angle = match value_of(prop::FONT_STYLE) {
+ Some(StyleValueData::FontStyle {
+ font_style,
+ angle_value,
+ }) if *font_style == crate::css::css_enums::font_style_keyword::OBLIQUE => angle_value
+ .optional_data()
+ .and_then(crate::css::table_group_builder::angle_degrees)
+ .unwrap_or(14.0),
+ _ => 14.0,
+ };
+ let mut font_synthesis = 0;
+ if matches!(value_of(prop::FONT_SYNTHESIS_WEIGHT), Some(StyleValueData::Keyword { keyword }) if *keyword == keyword::NONE)
+ {
+ font_synthesis |= bridge::FONT_SYNTHESIS_NO_WEIGHT;
+ }
+ match value_of(prop::FONT_SYNTHESIS_STYLE) {
+ Some(StyleValueData::Keyword { keyword }) if *keyword == keyword::NONE => {
+ font_synthesis |= bridge::FONT_SYNTHESIS_STYLE_NONE << bridge::FONT_SYNTHESIS_STYLE_SHIFT;
+ }
+ Some(StyleValueData::Keyword { keyword }) if *keyword == keyword::OBLIQUE_ONLY => {
+ font_synthesis |= bridge::FONT_SYNTHESIS_STYLE_OBLIQUE_ONLY << bridge::FONT_SYNTHESIS_STYLE_SHIFT;
+ }
+ _ => {}
+ }
let (font_weight, font_width) = match (value_of(prop::FONT_WEIGHT), value_of(prop::FONT_WIDTH)) {
(Some(StyleValueData::Number { value: weight }), Some(StyleValueData::Percentage { value: width })) => {
(*weight, *width)
@@ -1308,6 +1334,8 @@ pub(super) fn font_resolution_request<'a>(
font_weight,
font_width,
font_optical_sizing,
+ font_oblique_angle,
+ font_synthesis,
font_size_adjust,
font_size_adjust_metric,
font_size_adjust_value,
diff --git a/Libraries/LibWeb/Rust/src/css/style/font_resolution.rs b/Libraries/LibWeb/Rust/src/css/style/font_resolution.rs
index 06ab311948d..329a77e303d 100644
--- a/Libraries/LibWeb/Rust/src/css/style/font_resolution.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/font_resolution.rs
@@ -42,12 +42,15 @@ unsafe extern "C" {
#[derive(Clone, Copy, PartialEq, Eq, Hash)]
struct FontRequestScalars {
font_size_raw: i32,
- font_slope: i32,
font_weight: u64,
font_width: u64,
font_size_adjust_value: u64,
font_feature_values_scope: u32,
+ // NB: An f32's bits, which keep the request within its size.
+ font_oblique_angle: u32,
font_optical_sizing: u8,
+ /// The slope in the low two bits, and the synthesis bits above them, which keeps the request within its size.
+ font_slope_and_synthesis: u8,
font_size_adjust: FontSizeAdjustKind,
font_size_adjust_metric: u8,
}
@@ -56,12 +59,13 @@ impl FontRequestScalars {
fn of(request: &FfiFontResolutionRequest) -> Self {
Self {
font_size_raw: request.font_size_raw,
- font_slope: request.font_slope,
font_weight: request.font_weight.to_bits(),
font_width: request.font_width.to_bits(),
font_size_adjust_value: request.font_size_adjust_value.to_bits(),
+ font_oblique_angle: (request.font_oblique_angle as f32).to_bits(),
font_feature_values_scope: request.font_feature_values_scope,
font_optical_sizing: request.font_optical_sizing,
+ font_slope_and_synthesis: (request.font_slope as u8 & 3) | (request.font_synthesis << 2),
font_size_adjust: request.font_size_adjust,
font_size_adjust_metric: request.font_size_adjust_metric,
}
@@ -156,10 +160,12 @@ impl FontRequest {
None => [FfiHostHandle::from_pointer(std::ptr::null()); FONT_RESOLUTION_FEATURE_INPUT_COUNT],
},
font_size_raw: scalars.font_size_raw,
- font_slope: scalars.font_slope,
+ font_slope: i32::from(scalars.font_slope_and_synthesis & 3),
font_weight: f64::from_bits(scalars.font_weight),
font_width: f64::from_bits(scalars.font_width),
font_optical_sizing: scalars.font_optical_sizing,
+ font_oblique_angle: f64::from(f32::from_bits(scalars.font_oblique_angle)),
+ font_synthesis: scalars.font_slope_and_synthesis >> 2,
font_size_adjust: scalars.font_size_adjust,
font_size_adjust_metric: scalars.font_size_adjust_metric,
font_size_adjust_value: f64::from_bits(scalars.font_size_adjust_value),
@@ -695,6 +701,8 @@ mod tests {
font_weight: 400.0,
font_width: 100.0,
font_optical_sizing: 0,
+ font_oblique_angle: 14.0,
+ font_synthesis: 0,
font_size_adjust: FontSizeAdjustKind::None,
font_size_adjust_metric: 0,
font_size_adjust_value: 0.0,
@@ -758,6 +766,8 @@ mod tests {
font_weight: 700.0,
font_width: 100.0,
font_optical_sizing: 0,
+ font_oblique_angle: 14.0,
+ font_synthesis: 0,
font_size_adjust: FontSizeAdjustKind::None,
font_size_adjust_metric: 0,
font_size_adjust_value: 0.0,
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/compute.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/compute.rs
index 1af3831a338..4d8069a35a2 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/compute.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/compute.rs
@@ -2691,6 +2691,8 @@ fn font_resolution_selects_by(property: u16) -> bool {
| prop::FONT_WIDTH
| prop::FONT_OPTICAL_SIZING
| prop::FONT_SIZE_ADJUST
+ | prop::FONT_SYNTHESIS_WEIGHT
+ | prop::FONT_SYNTHESIS_STYLE
)
}
diff --git a/Libraries/LibWeb/Rust/src/css/style/pipeline/drive.rs b/Libraries/LibWeb/Rust/src/css/style/pipeline/drive.rs
index 4d665848817..ae62b9c000e 100644
--- a/Libraries/LibWeb/Rust/src/css/style/pipeline/drive.rs
+++ b/Libraries/LibWeb/Rust/src/css/style/pipeline/drive.rs
@@ -245,6 +245,8 @@ impl RetainedState {
font_weight: 400.0,
font_width: 100.0,
font_optical_sizing: 0,
+ font_oblique_angle: 14.0,
+ font_synthesis: 0,
font_size_adjust: bridge::FontSizeAdjustKind::None,
font_size_adjust_metric: 0,
font_size_adjust_value: 0.0,
diff --git a/Libraries/LibWeb/Rust/src/css/style_compute.rs b/Libraries/LibWeb/Rust/src/css/style_compute.rs
index 912c2b62d90..96ae77d43d7 100644
--- a/Libraries/LibWeb/Rust/src/css/style_compute.rs
+++ b/Libraries/LibWeb/Rust/src/css/style_compute.rs
@@ -5799,6 +5799,8 @@ pub(crate) fn font_value_computes_natively(property_id: u16, data: &StyleValueDa
| prop::FONT_KERNING
| prop::FONT_LANGUAGE_OVERRIDE
| prop::FONT_OPTICAL_SIZING
+ | prop::FONT_SYNTHESIS_STYLE
+ | prop::FONT_SYNTHESIS_WEIGHT
| prop::FONT_VARIANT_ALTERNATES
| prop::FONT_VARIANT_CAPS
| prop::FONT_VARIANT_EAST_ASIAN
diff --git a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
index d7dcb823cee..30c648e4056 100644
--- a/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
+++ b/Libraries/LibWeb/Rust/src/css/table_group_builder.rs
@@ -3355,6 +3355,8 @@ unsafe fn build_font_group(
font_family: retained(property_id::FONT_FAMILY),
font_style: retained(property_id::FONT_STYLE),
font_optical_sizing: retained(property_id::FONT_OPTICAL_SIZING),
+ font_synthesis_weight: retained(property_id::FONT_SYNTHESIS_WEIGHT),
+ font_synthesis_style: retained(property_id::FONT_SYNTHESIS_STYLE),
font_feature_settings: retained(property_id::FONT_FEATURE_SETTINGS),
font_kerning: retained(property_id::FONT_KERNING),
font_language_override: retained(property_id::FONT_LANGUAGE_OVERRIDE),
diff --git a/Tests/LibWeb/Layout/expected/svg-text-with-percentage-values.txt b/Tests/LibWeb/Layout/expected/svg-text-with-percentage-values.txt
index 809b3499768..d5805409025 100644
--- a/Tests/LibWeb/Layout/expected/svg-text-with-percentage-values.txt
+++ b/Tests/LibWeb/Layout/expected/svg-text-with-percentage-values.txt
@@ -3,13 +3,13 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 261.328125 0+0+8] children: inline
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 784x261.328125] baseline: 261.328125
SVGSVGBox <svg> at [8,8] [0+0+0 784 0+0+0] [0+0+0 261.328125 0+0+0] viewport-transform=[3.2666016 0 0 3.2666016 0 0] [SVG] children: not-inline
- SVGTextBox <text.small> at [24,17.609375] [0+0+0 15.390625 0+0+0] [0+0+0 13 0+0+0] children: inline
+ SVGTextBox <text.small> at [24,17.609375] [0+0+0 16.265625 0+0+0] [0+0+0 13 0+0+0] children: inline
TextNode <#text> (not painted)
SVGTextBox <text.heavy> at [40.796875,4] [0+0+0 47.046875 0+0+0] [0+0+0 30 0+0+0] children: inline
TextNode <#text> (not painted)
- SVGTextBox <text.small> at [60,33.609375] [0+0+0 11.296875 0+0+0] [0+0+0 13 0+0+0] children: inline
+ SVGTextBox <text.small> at [60,33.609375] [0+0+0 11.484375 0+0+0] [0+0+0 13 0+0+0] children: inline
TextNode <#text> (not painted)
- SVGTextBox <text.Rrrrr> at [72,12] [0+0+0 161.265625 0+0+0] [0+0+0 40 0+0+0] children: inline
+ SVGTextBox <text.Rrrrr> at [72,12] [0+0+0 165.515625 0+0+0] [0+0+0 40 0+0+0] children: inline
TextNode <#text> (not painted)
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt b/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt
index efc6cc36049..c94b142b6c7 100644
--- a/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt
+++ b/Tests/LibWeb/Layout/expected/svg-text-with-viewbox.txt
@@ -3,13 +3,13 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] [BFC] children
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 261.328125 0+0+8] children: inline
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 784x261.328125] baseline: 261.328125
SVGSVGBox <svg> at [8,8] [0+0+0 784 0+0+0] [0+0+0 261.328125 0+0+0] viewport-transform=[3.2666016 0 0 3.2666016 0 0] [SVG] children: not-inline
- SVGTextBox <text.small> at [20,24.609375] [0+0+0 15.390625 0+0+0] [0+0+0 13 0+0+0] children: inline
+ SVGTextBox <text.small> at [20,24.609375] [0+0+0 16.265625 0+0+0] [0+0+0 13 0+0+0] children: inline
TextNode <#text> (not painted)
SVGTextBox <text.heavy> at [40,11] [0+0+0 47.046875 0+0+0] [0+0+0 30 0+0+0] children: inline
TextNode <#text> (not painted)
- SVGTextBox <text.small> at [55,44.609375] [0+0+0 11.296875 0+0+0] [0+0+0 13 0+0+0] children: inline
+ SVGTextBox <text.small> at [55,44.609375] [0+0+0 11.484375 0+0+0] [0+0+0 13 0+0+0] children: inline
TextNode <#text> (not painted)
- SVGTextBox <text.Rrrrr> at [65,23] [0+0+0 161.265625 0+0+0] [0+0+0 40 0+0+0] children: inline
+ SVGTextBox <text.Rrrrr> at [65,23] [0+0+0 165.515625 0+0+0] [0+0+0 40 0+0+0] children: inline
TextNode <#text> (not painted)
TextNode <#text> (not painted)
diff --git a/Tests/LibWeb/Ref/expected/font-synthesis-style-of-regular-only-web-font-notref.html b/Tests/LibWeb/Ref/expected/font-synthesis-style-of-regular-only-web-font-notref.html
new file mode 100644
index 00000000000..66020f086ec
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/font-synthesis-style-of-regular-only-web-font-notref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+ @font-face {
+ font-family: "RegularOnly";
+ src: url(../input/wpt-import/fonts/Lato-Medium.ttf);
+ }
+ p { font: 40px RegularOnly; font-style: italic; margin: 0; font-synthesis: none; }
+</style>
+<p>Synthesized text</p>
diff --git a/Tests/LibWeb/Ref/expected/font-synthesis-weight-of-regular-only-web-font-notref.html b/Tests/LibWeb/Ref/expected/font-synthesis-weight-of-regular-only-web-font-notref.html
new file mode 100644
index 00000000000..855020d37f3
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/font-synthesis-weight-of-regular-only-web-font-notref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<style>
+ @font-face {
+ font-family: "RegularOnly";
+ src: url(../input/wpt-import/fonts/Lato-Medium.ttf);
+ }
+ p { font: 40px RegularOnly; font-weight: bold; margin: 0; font-synthesis: none; }
+</style>
+<p>Synthesized text</p>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-01-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-01-ref.html
new file mode 100644
index 00000000000..d695cc8a967
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-01-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: none disables fake bold</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-02-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-02-ref.html
new file mode 100644
index 00000000000..9f644103c7e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-02-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: style disables fake bold</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-03-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-03-ref.html
new file mode 100644
index 00000000000..3994838ba4a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-03-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: none disables fake italic/oblique</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-04-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-04-ref.html
new file mode 100644
index 00000000000..9aba7216aca
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-04-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: bold disables fake italic/oblique</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-05-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-05-ref.html
new file mode 100644
index 00000000000..2820794de1f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-05-ref.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: initial value</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ font-synthesis: weight style;
+ color: green;
+ }
+</style>
+
+<p>Test passes if the text below is green, not red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <!-- Synthesis is allowed, but not required -->
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-06-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-06-ref.html
new file mode 100644
index 00000000000..51871a4ff33
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-06-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>Reference: 'font-synthesis:none' with a font that support small-caps</title>
+<link rel="author" title="Mats Palmgren" href="mailto:[email protected]">
+<style>
+ @font-face {
+ font-family: fwf;
+ src: url(support/fonts/FontWithFancyFeatures.otf);
+ }
+ .test {
+ font: 2em/1 fwf;
+ }
+</style>
+
+<p>Test passes if there are four check marks (✓), and zero crosses (✗). </p>
+<p class="test">CCC C</p>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-07-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-07-ref.html
new file mode 100644
index 00000000000..e57961ffb3a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-07-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Reference: 'font-synthesis:none' with a font that doesn't support small-caps</title>
+<link rel="author" title="Mats Palmgren" href="mailto:[email protected]">
+<style>
+ @font-face {
+ font-family: Lato;
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font: 2em/1 Lato;
+ }
+</style>
+
+<p>Test passes if "A" is upper-case and "bcd e" is lower-case.</p>
+<p class="test">Abcd e</p>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-08-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-08-ref.html
new file mode 100644
index 00000000000..6ac4261202e
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-08-ref.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis style and weight</title>
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+ .auto {
+ font-style: italic;
+ font-weight: bold;
+ }
+ .weight {
+ font-weight: bold;
+ }
+ .style {
+ font-style: italic;
+ }
+</style>
+
+<section class="test">
+ <p class="auto">Filler text</p>
+ <p class>Filler text</p>
+ <p class="weight">Filler text</p>
+ <p class="style">Filler text</p>
+</section>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-binary-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-binary-ref.html
new file mode 100644
index 00000000000..8ab9ecd2953
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-binary-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style: none disables fake italic/oblique</title>
+<style>
+ @font-face {
+ font-family: "NotoSans subset";
+ src: url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAs4ABEAAAAAEsAAAArbAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbgQ4cMgZgAGQIgX4JjzQREAqGGIU9CxQAATYCJAMkBCAFgjgHIAyEGhsoESMRwcYBBPS+OtlfHphDRE0PmY9orCaG8CHhhnQfLmmvI6tM6zjqEHjW5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pVQKVVW69QJtZKlFtXGmWqBXZi1IZ1tvu2GjTgEuzTbjtTDCVK9IEjTJ6NVgTbWvRItDqazi4IL2IXBInaU9hwIojsFvPnJkyyJktxCJBmJsHd3EtvXbWJ7u+eyPd0V7IVu5DUhhanChCtMm01Pmshqww7DCwYSY4nm+yUaEYnaWSAPQeaTG4S0NU5hl7SilkYDG2i0sP7GbLaZmabhA9/Z+GQjfrPxy0ac2pYixVviJL1FJ+l0dTrM6l7QYQWRTyDDCKTUBtIDq93wA1B6QKF4RKM70c4J0ZGTY7tTHrHbwkrBF0abw0aHdXy9NyyTNw7S7nNPILTds2HbNijutnCRwx32p3k0a+M8C11InzYRD8VbMJiT0xQcXcggBwVyzeNBLoyfo0MSjCZYS60QJseRIgKaYJFLbAIAAA==);
+ font-style: normal;
+ font-weight: normal;
+ }
+ .test {
+ font-family: "NotoSans subset";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-letter-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-letter-ref.html
new file mode 100644
index 00000000000..1a22799ebce
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-letter-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style apply to ::first-letter</title>
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ font-kerning: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler</p>
+ <p>Filler</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-line-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-line-ref.html
new file mode 100644
index 00000000000..8487a2c783a
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-first-line-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style apply to ::first-line</title>
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the first line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text<br>Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-ref.html
new file mode 100644
index 00000000000..0151ef30199
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-style-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style: none disables fake italic/oblique</title>
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-binary-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-binary-ref.html
new file mode 100644
index 00000000000..67b9cc4b38c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-binary-ref.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Test: font-synthesis-weight: none disables fake bold</title>
+<style>
+ @font-face {
+ font-family: "NotoSans subset";
+ src: url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAs4ABEAAAAAEsAAAArbAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbgQ4cMgZgAGQIgX4JjzQREAqGGIU9CxQAATYCJAMkBCAFgjgHIAyEGhsoESMRwcYBBPS+OtlfHphDRE0PmY9orCaG8CHhhnQfLmmvI6tM6zjqEHjW5ciGfInp7m/Y/hupDzxeun7CTf/dXYIFq2myz6BitMwkK3UqKSRoBapGJ87E2okL/W6G/znV9yX5a3nMWOmGayEjhRbAMcbxEpAC1ivipYE4BLnteGCjFFInNLJmN4vOkKrBFt3w/9W9yiW0C6TCU1/Zdhn+txwkqSh/oClTy3NzlGzDdctb1y4bb0n6o/73PwA/+syKMLhc+9ducvdRcVERqApHStaYbJIHuTyi/YS5ArKqrJCtq6sjgvEVpg5YWNtjv/nQ2ix46gpueIuozzcNIABQM7C4bJcDqp5NBcUakNalI30Qe4609wJ3BUYHIBcF8MDYOpsVHQ8D6W0fGYBY2w8AqRkpwKAAZPVzhASScRkhILCl10/yyLeWYb0lE/KZ0Qu4o31REYXA1ltV4pgrE2oX2gk0KOjDtAUAsdUdkJegI0CBMUNjiqYwprZnK3bBmllbBzzOkrbtvwJ7J9jNATrxwRsAVBV9OwBw5kiS49ZIgbs9mn67/wVOmXbd+owYtWTN4/7N9j2OOeygPXbbEQJzWlksMCDU2yHBQrstHUdVQKxDRJbpqP/byO+I/ZXE/Ht9Z7Ue96r6H5hV0FHIAsoLwu/I6dtB8/+t59e5v3xXEoMabYr8LHnQ4qmRX8Rl0ADAPjtsstJRZ30G41h42nmH4e51elw65Dh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Xtgdo/7pbOtubiSuo5eIjKgCeodTAcejgZN1zPtZvHJzCpzAZj/CTdvhLZQbQeAxj0EjQA9BSxAQm0ycHbZCmlbm0CkxBEa5qEQQtDkwjMsGpvKjyJhkS3P6wM9J4Hq0FDlhrRrVOXUZwiZoWWOOUBMwg19mmfttKAVvlmgcP60vY5bHCM2gV7NGKRNm0oqjUIs0FyCMxpg2HqtJCaAMbUwHaAdy41tHzqF8io24A9GicPtwTmNCOV7Z63nVP4q5iegoqqPAEzr0gLOpyIX1ZZOAm49IOGnbBaCJcusRaibzgd6dLnp99IJz7BK8331nmxF7klj0B6zG7eHZ8o7KZcglPinOhHLniPKEkCf4lDImJFZBZ5MSS+KH4o0uYaVINrpfK2Mml+2Y0yXIZsUpVQKVVW69QJtZKlFtXGmWqBXZi1IZ1tvu2GjTgEuzTbjtTDCVK9IEjTJ6NVgTbWvRItDqazi4IL2IXBInaU9hwIojsFvPnJkyyJktxCJBmJsHd3EtvXbWJ7u+eyPd0V7IVu5DUhhanChCtMm01Pmshqww7DCwYSY4nm+yUaEYnaWSAPQeaTG4S0NU5hl7SilkYDG2i0sP7GbLaZmabhA9/Z+GQjfrPxy0ac2pYixVviJL1FJ+l0dTrM6l7QYQWRTyDDCKTUBtIDq93wA1B6QKF4RKM70c4J0ZGTY7tTHrHbwkrBF0abw0aHdXy9NyyTNw7S7nNPILTds2HbNijutnCRwx32p3k0a+M8C11InzYRD8VbMJiT0xQcXcggBwVyzeNBLoyfo0MSjCZYS60QJseRIgKaYJFLbAIAAA==);
+ font-style: normal;
+ font-weight: normal;
+ }
+ .test {
+ font-family: "NotoSans subset";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-letter-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-letter-ref.html
new file mode 100644
index 00000000000..5fb16315231
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-letter-ref.html
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-weight apply to ::first-letter</title>
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ font-kerning: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler</p>
+ <p>Filler</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-line-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-line-ref.html
new file mode 100644
index 00000000000..6f1e769e15d
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-first-line-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-weight apply to ::first-line</title>
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the first line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text<br>Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-ref.html
new file mode 100644
index 00000000000..74858cf13a2
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-ref.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Test: font-synthesis-weight: none disables fake bold</title>
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold-ref.html
new file mode 100644
index 00000000000..883f868bc30
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold-ref.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang = "en">
+ <meta charset="utf-8">
+ <title>CSS Test: font synthesis weight: bold web font should not be "double emboldened"</title>
+ <style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Bold.ttf)
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+ </style>
+
+ <p class="test">Filler text</p>
+</html>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/FontWithFancyFeatures.otf b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/FontWithFancyFeatures.otf
new file mode 100644
index 00000000000..8c884829da4
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/FontWithFancyFeatures.otf differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf
new file mode 100644
index 00000000000..ea32e1787e5
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf
new file mode 100644
index 00000000000..3897d45e554
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001-ref.html
new file mode 100644
index 00000000000..49fe4d4b818
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001-ref.html
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Fonts reference: synthetic bold does not separate a combining mark from its base</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+
+<style>
+/* Same font, size and weight as the test -- so the same synthesized bold is
+ applied -- but drawing each cluster's bars with a single precomposed glyph
+ instead of a base plus marks, so no GPOS mark positioning is involved. 'B' is
+ the bottom and middle bars, 'C' is all three. Each glyph is one typographic
+ character unit, exactly as each base-plus-marks cluster in the test is. */
+@font-face {
+ font-family: "mark-anchor-test";
+ src: url("../../fonts/mark-anchor-test.ttf") format("truetype");
+}
+div {
+ font-family: "mark-anchor-test";
+ font-size: 100px;
+ line-height: 150px;
+ font-weight: bold;
+ font-synthesis: weight;
+ white-space: nowrap;
+}
+</style>
+
+<p>Test passes if every black bar below is exactly as wide as, and left-aligned
+with, the bars above and below it in the same group &mdash; two groups in the
+middle row &mdash; and no bar is offset to the right of the others.</p>
+
+<div>&#x42;</div>
+<div>&#x42;&#x42;</div>
+<div>&#x43;</div>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002-ref.html
new file mode 100644
index 00000000000..add0d4599a0
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002-ref.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Fonts reference: synthetic bold does not separate a combining mark from its base in RTL</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+
+<style>
+/* Same font, size, weight and direction as the test, so the same bold is
+ synthesized, but drawing each cluster's bars with one precomposed glyph instead
+ of a base plus marks, so no GPOS mark positioning is involved. */
+@font-face {
+ font-family: "mark-anchor-test";
+ src: url("../../fonts/mark-anchor-test.ttf") format("truetype");
+}
+div {
+ font-family: "mark-anchor-test";
+ font-size: 100px;
+ line-height: 150px;
+ font-weight: bold;
+ font-synthesis: weight;
+ direction: rtl;
+ white-space: nowrap;
+}
+</style>
+
+<p>Test passes if every black bar below is exactly as wide as, and right-aligned
+with, the bars above and below it in the same group &mdash; two groups in the
+middle row &mdash; and no bar is offset to the left of the others.</p>
+
+<div>&#x5D1;</div>
+<div>&#x5D1;&#x5D1;</div>
+<div>&#x5D2;</div>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range-ref.html
new file mode 100644
index 00000000000..942b2529f62
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Tests that font-weight with value outside of the 'wght' range support by the font does not synthesize bold faces.</title>
+<style>
+ @font-face {
+ font-family: "Inter";
+ src: url('support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf');
+ }
+ .style600 {
+ font-family: "Inter";
+ font-size: 3em;
+ font-weight: 500;
+ }
+</style>
+
+<p class="style600">text</p>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-space-width-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-space-width-ref.html
new file mode 100644
index 00000000000..1d150f07bba
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-bold-space-width-ref.html
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<link rel="author" title="Myles C. Maxfield" href="[email protected]">
+<style>
+pre {
+ font: bold 12px 'Monaco';
+}
+</style>
+<body>
+<p>This test passes if the simple and complex text code paths give space characters the same advance under synthetic bold.</p>
+<pre style="font-feature-settings: 'ABCD';"><strong>hi asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</strong></pre>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range-ref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range-ref.html
new file mode 100644
index 00000000000..f2a5ba01aef
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range-ref.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Tests that font-style with angle outside of the 'slnt' range support by the font does not synthesize oblique faces.</title>
+<style>
+ @font-face {
+ font-family: "Inter";
+ src: url('support/fonts/Inter-VF.subset.ttf');
+ }
+ .style10 {
+ font-family: "Inter";
+ font-size: 3em;
+ font-style: oblique 10deg;
+ }
+</style>
+
+<p class="style10">text</p>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-bold-notref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-bold-notref.html
new file mode 100644
index 00000000000..4a952acb46f
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-bold-notref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Test: Test for synthetic bold rendering</title>
+ <style type="text/css">
+ div {
+ font-size: 36px;
+ font-family: "CSSTest Verify";
+ }
+ </style>
+ </head>
+ <body>
+ <div><a href="http://www.w3.org/Style/CSS/Test/Fonts/">Test fonts</a> must be installed for this test: PASS</div>
+ <p>Browser supports synthetic bolding if PASS appears on both lines and the second line appears bolder:</p>
+ <div>PASS</div>
+ <div>PASS</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-italic-notref.html b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-italic-notref.html
new file mode 100644
index 00000000000..3684f3ae804
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/wpt-import/css/css-fonts/test-synthetic-italic-notref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Test: Test for synthetic italic rendering</title>
+ <style type="text/css">
+ div { font-size: 36px; }
+ span#verify { font-family: "CSSTest Verify"; }
+ div#test1, div#test2 {
+ font-family: CSSTest Verify;
+ }
+ </style>
+ </head>
+ <body>
+ <div><a href="http://www.w3.org/Style/CSS/Test/Fonts/">Test fonts</a> must be installed for this test: <span id="verify">FAIL</span></div>
+ <p>Browser supports synthetic italics if PASS appears on both lines and the second line is slanted right:</p>
+ <div id="test1">FAIL</div>
+ <div id="test2">FAIL</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Bold.ttf b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Bold.ttf
new file mode 100644
index 00000000000..016068b486e
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Bold.ttf differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Medium.ttf b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Medium.ttf
new file mode 100644
index 00000000000..2c612da2ae5
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/Lato-Medium.ttf differ
diff --git a/Tests/LibWeb/Ref/expected/wpt-import/fonts/mark-anchor-test.ttf b/Tests/LibWeb/Ref/expected/wpt-import/fonts/mark-anchor-test.ttf
new file mode 100644
index 00000000000..03def55fa9a
Binary files /dev/null and b/Tests/LibWeb/Ref/expected/wpt-import/fonts/mark-anchor-test.ttf differ
diff --git a/Tests/LibWeb/Ref/input/background-clip-text-in-scaled-ancestor.html b/Tests/LibWeb/Ref/input/background-clip-text-in-scaled-ancestor.html
index 2f03deaff43..170fb58f22e 100644
--- a/Tests/LibWeb/Ref/input/background-clip-text-in-scaled-ancestor.html
+++ b/Tests/LibWeb/Ref/input/background-clip-text-in-scaled-ancestor.html
@@ -1,5 +1,5 @@
<!DOCTYPE html>
-<meta name="fuzzy" content="maxDifference=0-17;totalPixels=0-1097" />
+<meta name="fuzzy" content="maxDifference=0-90;totalPixels=0-1097" />
<link rel="match" href="../expected/background-clip-text-in-scaled-ancestor-ref.html" />
<style>
body { margin: 0; }
diff --git a/Tests/LibWeb/Ref/input/font-synthesis-style-of-regular-only-web-font.html b/Tests/LibWeb/Ref/input/font-synthesis-style-of-regular-only-web-font.html
new file mode 100644
index 00000000000..279904645e5
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/font-synthesis-style-of-regular-only-web-font.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<link rel="mismatch" href="../expected/font-synthesis-style-of-regular-only-web-font-notref.html">
+<style>
+ @font-face {
+ font-family: "RegularOnly";
+ src: url(wpt-import/fonts/Lato-Medium.ttf);
+ }
+ p { font: 40px RegularOnly; font-style: italic; margin: 0; }
+</style>
+<p>Synthesized text</p>
diff --git a/Tests/LibWeb/Ref/input/font-synthesis-weight-of-regular-only-web-font.html b/Tests/LibWeb/Ref/input/font-synthesis-weight-of-regular-only-web-font.html
new file mode 100644
index 00000000000..ab8fb54b444
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/font-synthesis-weight-of-regular-only-web-font.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<link rel="mismatch" href="../expected/font-synthesis-weight-of-regular-only-web-font-notref.html">
+<style>
+ @font-face {
+ font-family: "RegularOnly";
+ src: url(wpt-import/fonts/Lato-Medium.ttf);
+ }
+ p { font: 40px RegularOnly; font-weight: bold; margin: 0; }
+</style>
+<p>Synthesized text</p>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-01.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-01.html
new file mode 100644
index 00000000000..0e404279bff
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-01.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: none disables fake bold</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-01-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
+<meta name="assert" content=" If ‘weight’ is not specified, user agents must not synthesize bold faces">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-weight: bold;
+ font-synthesis: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-02.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-02.html
new file mode 100644
index 00000000000..4e26ecf92cc
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-02.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: style disables fake bold</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-02-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
+<meta name="assert" content=" If ‘weight’ is not specified, user agents must not synthesize bold faces">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis: style) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-weight: bold;
+ font-synthesis: style;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-03.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-03.html
new file mode 100644
index 00000000000..e036040c6f0
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-03.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: none disables fake italic/oblique</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-03-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
+<meta name="assert" content="if ‘style’ is not specified user agents must not synthesize italic faces">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-style: italic;
+ font-synthesis: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-04.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-04.html
new file mode 100644
index 00000000000..dadbce33492
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-04.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: bold disables fake italic/oblique</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-04-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
+<meta name="assert" content="if ‘style’ is not specified user agents must not synthesize italic faces">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis: weight) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-style: italic;
+ font-synthesis: weight;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-05.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-05.html
new file mode 100644
index 00000000000..b810be99343
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-05.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+<title>CSS Test: font-synthesis: initial value</title>
+<link rel="author" title="Chris Lilley" href="[email protected]">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-05-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-prop">
+<meta name="assert" content="This property controls whether user agents are allowed to synthesize bold or oblique font faces">
+<style>
+ @font-face {
+ font-family: "test";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis: weight style) {
+ .test p {color: red;}
+ }
+ .test {
+ font-family: "test";
+ font-size: 3em;
+ font-synthesis: weight style;
+ color: green;
+ }
+</style>
+
+<p>Test passes if the text below is green, not red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <!-- Synthesis is allowed, but not required -->
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-06.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-06.html
new file mode 100644
index 00000000000..38dab2642cf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-06.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Test: 'font-synthesis:none' with a font that support small-caps</title>
+<link rel="author" title="Mats Palmgren" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-synthesis">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-06-ref.html">
+<meta name="assert" content="font-synthesis:none should not affect a font that supports small-caps">
+<style>
+ @font-face {
+ font-family: fwf;
+ src: url(support/fonts/FontWithFancyFeatures.otf);
+ }
+ .test {
+ font: 2em/1 fwf;
+ font-variant: small-caps;
+ font-synthesis: none;
+ }
+</style>
+
+<p>Test passes if there are four check marks (✓), and zero crosses (✗). </p>
+<p class="test">JJJ J</p>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-07.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-07.html
new file mode 100644
index 00000000000..9cb48fe7d37
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-07.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>CSS Test: 'font-synthesis:none' with a font that doesn't support small-caps</title>
+<link rel="author" title="Mats Palmgren" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-fonts/#font-synthesis">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-07-ref.html">
+<meta name="assert" content="font-synthesis:none inhibits synthesising small-caps">
+<style>
+ @font-face {
+ font-family: Lato;
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font: 2em/1 Lato;
+ font-variant: small-caps;
+ font-synthesis: none;
+ }
+</style>
+
+<p>Test passes if "A" is upper-case and "bcd e" is lower-case.</p>
+<p class="test">Abcd e</p>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-08.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-08.html
new file mode 100644
index 00000000000..bc698722e32
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-08.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis style and weight</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-08-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis">
+<meta name="assert" content="If ‘weight’/'style' is not specified for
+ font-synthesis property, user agents must not synthesize bold/italic faces">
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ font-style: italic;
+ font-weight: bold;
+ }
+ .auto {
+ font-synthesis: weight style;
+ }
+ .none {
+ font-synthesis: none;
+ }
+ .weight {
+ font-synthesis: weight;
+ }
+ .style {
+ font-synthesis: style;
+ }
+</style>
+
+<!-- If a previous font-synthesis property and value was encountered by the
+ style engine, make sure that this newer value is correctly updated and not
+ confused with an earlier value due to incorrect caching. Appearance of the
+ 4 section needs to differ in weight and style respectively. -->
+<section class="test">
+ <p class="auto">Filler text</p>
+ <p class="none">Filler text</p>
+ <p class="weight">Filler text</p>
+ <p class="style">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-binary.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-binary.html
new file mode 100644
index 00000000000..c94b804a642
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-binary.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style: none disables fake italic/oblique</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-style-binary-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-style">
+<meta name="assert" content=" If ‘style’ is not specified, user agents must not synthesize italic faces for base64 encoded fonts">
+<style>
+ @font-face {
+ font-family: "NotoSans subset";
+ src: url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAAs4ABEAAAAAEsAAAArbAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGhYbgQ4cMgZgAGQIgX4JjzQREAqGGIU9CxQAATYCJAMkBCAFgjgHIAyEGhsoESMRwcYBBPS+OtlfHphDRE0PmY9orCaG8CH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aVINrpfK2Mml+2Y0yXIZsUpVQKVVW69QJtZKlFtXGmWqBXZi1IZ1tvu2GjTgEuzTbjtTDCVK9IEjTJ6NVgTbWvRItDqazi4IL2IXBInaU9hwIojsFvPnJkyyJktxCJBmJsHd3EtvXbWJ7u+eyPd0V7IVu5DUhhanChCtMm01Pmshqww7DCwYSY4nm+yUaEYnaWSAPQeaTG4S0NU5hl7SilkYDG2i0sP7GbLaZmabhA9/Z+GQjfrPxy0ac2pYixVviJL1FJ+l0dTrM6l7QYQWRTyDDCKTUBtIDq93wA1B6QKF4RKM70c4J0ZGTY7tTHrHbwkrBF0abw0aHdXy9NyyTNw7S7nNPILTds2HbNijutnCRwx32p3k0a+M8C11InzYRD8VbMJiT0xQcXcggBwVyzeNBLoyfo0MSjCZYS60QJseRIgKaYJFLbAIAAA==);
+ font-style: normal;
+ font-weight: 400;
+ }
+ @supports not (font-synthesis-style: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "NotoSans subset";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-style: italic;
+ font-synthesis-style: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-letter.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-letter.html
new file mode 100644
index 00000000000..8f55764e290
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-letter.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style apply to ::first-letter</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-style-first-letter-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-style">
+<meta name="assert" content="If ‘style’ is not specified, user agents must not synthesize italic faces">
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-style: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ font-kerning: none;
+ }
+ p.nosynth::first-letter {
+ font-style: italic;
+ font-synthesis-style: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler</p>
+ <p class="nosynth">Filler</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-line.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-line.html
new file mode 100644
index 00000000000..fa32d26d148
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style-first-line.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style apply to ::first-line</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-style-first-line-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-style">
+<meta name="assert" content="If ‘style’ is not specified, user agents must not synthesize italic faces">
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-style: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ }
+ p.nosynth::first-line {
+ font-style: italic;
+ font-synthesis-style: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the first line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p class="nosynth">Filler text<br>Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style.html
new file mode 100644
index 00000000000..a3716680422
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-style.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-style: none disables fake italic/oblique</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-style-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-style">
+<meta name="assert" content=" If ‘style’ is not specified, user agents must not synthesize italic faces">
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-style: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-style: italic;
+ font-synthesis-style: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not obliqued</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-binary.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-binary.html
new file mode 100644
index 00000000000..864ef9587cf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-binary.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Test: font-synthesis-weight: none disables fake bold</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-weight-binary-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-weight">
+<meta name="assert" content=" If ‘weight’ is not specified, user agents must not synthesize bold faces for embedded fonts">
+<style>
+ @font-face {
+ font-family: "NotoSans subset";
+ src: url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAA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qF8io24A9GicPtwTmNCOV7Z63nVP4q5iegoqqPAEzr0gLOpyIX1ZZOAm49IOGnbBaCJcusRaibzgd6dLnp99IJz7BK8331nmxF7klj0B6zG7eHZ8o7KZcglPinOhHLniPKEkCf4lDImJFZBZ5MSS+KH4o0uYaVINrpfK2Mml+2Y0yXIZsUpVQKVVW69QJtZKlFtXGmWqBXZi1IZ1tvu2GjTgEuzTbjtTDCVK9IEjTJ6NVgTbWvRItDqazi4IL2IXBInaU9hwIojsFvPnJkyyJktxCJBmJsHd3EtvXbWJ7u+eyPd0V7IVu5DUhhanChCtMm01Pmshqww7DCwYSY4nm+yUaEYnaWSAPQeaTG4S0NU5hl7SilkYDG2i0sP7GbLaZmabhA9/Z+GQjfrPxy0ac2pYixVviJL1FJ+l0dTrM6l7QYQWRTyDDCKTUBtIDq93wA1B6QKF4RKM70c4J0ZGTY7tTHrHbwkrBF0abw0aHdXy9NyyTNw7S7nNPILTds2HbNijutnCRwx32p3k0a+M8C11InzYRD8VbMJiT0xQcXcggBwVyzeNBLoyfo0MSjCZYS60QJseRIgKaYJFLbAIAAA==);
+ font-style: normal;
+ font-weight: normal;
+ }
+ @supports not (font-synthesis-weight: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "NotoSans subset";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-weight: 700;
+ font-synthesis-weight: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-letter.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-letter.html
new file mode 100644
index 00000000000..ac3337197bf
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-letter.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-weight apply to ::first-letter</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-weight-first-letter-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-weight">
+<meta name="assert" content="If ‘weight’ is not specified, user agents must not synthesize bold faces">
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-weight: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ font-kerning: none;
+ }
+ p.nosynth::first-letter {
+ font-weight: bold;
+ font-synthesis-weight: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler</p>
+ <p class="nosynth">Filler</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-line.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-line.html
new file mode 100644
index 00000000000..526fb6bf818
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-first-line.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8"/>
+<title>CSS Test: font-synthesis-weight apply to ::first-line</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-weight-first-line-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-3/#font-synthesis-weight">
+<meta name="assert" content="If ‘weight’ is not specified, user agents must not synthesize bold faces">
+<style>
+ @font-face {
+ font-family: "Lato-Medium";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-weight: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "Lato-Medium";
+ font-size: 3em;
+ }
+ p.nosynth::first-line {
+ font-weight: bold;
+ font-synthesis-weight: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the first line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p class="nosynth">Filler text<br>Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold.html
new file mode 100644
index 00000000000..4172af8921c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang = "en">
+ <meta charset="utf-8">
+ <title>CSS Test: font synthesis weight: bold web font should not be "double emboldened"</title>
+ <link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-weight-webfont-bold-ref.html">
+ <link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-weight">
+ <meta name="assert" content=" If font face is already bold, user agents must not synthesize bold face again">
+ <style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Bold.ttf)
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+ .synth {
+ font-weight: bold;
+ }
+ </style>
+
+ <p class="test synth">Filler text</p>
+</html>
\ No newline at end of file
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight.html
new file mode 100644
index 00000000000..b5c44739ec8
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/font-synthesis-weight.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Test: font-synthesis-weight: none disables fake bold</title>
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/font-synthesis-weight-ref.html">
+<link rel="help" href="https://www.w3.org/TR/css-fonts-4/#font-synthesis-weight">
+<meta name="assert" content=" If ‘weight’ is not specified, user agents must not synthesize bold faces">
+<style>
+ @font-face {
+ font-family: "lato";
+ src: url(../../fonts/Lato-Medium.ttf);
+ }
+ @supports not (font-synthesis-weight: none) {
+ .test {color: red;}
+ }
+ .test {
+ font-family: "lato";
+ font-size: 3em;
+ }
+ .nosynth {
+ font-weight: bold;
+ font-synthesis-weight: none;
+ }
+</style>
+
+<p>Test passes if the two lines below are identical (the second line is <em>not bold</em>), and there is no red.</p>
+<section class="test">
+ <p>Filler text</p>
+ <p class="nosynth">Filler text</p>
+</section>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf
new file mode 100644
index 00000000000..ea32e1787e5
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/Inter-VF.subset.ttf differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf
new file mode 100644
index 00000000000..3897d45e554
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001.html
new file mode 100644
index 00000000000..5ccda3fc7d4
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001.html
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Fonts test: synthetic bold does not separate a combining mark from its base</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-001-ref.html">
+<meta name="assert" content="When a bold weight is synthesized for a family with no bold face, the synthesis must not displace a combining mark relative to the base it is attached to, even when the font positions the mark with a GPOS mark-to-base anchor rather than with glyph advances.">
+
+<style>
+/* ../../fonts/mark-anchor-test.ttf has a single Regular face, so requesting bold
+ makes the UA synthesize one. Each glyph is a full-width bar in its own
+ horizontal band: 'A' is the bottom bar, U+0301 the middle bar, U+0300 the top
+ bar, and the marks are zero-advance glyphs anchored directly above their base.
+ 'B' draws the bottom and middle bars as one glyph and 'C' draws all three.
+
+ Both the test and the reference request bold, so whatever the UA's synthesis
+ does -- widen the advance and smear, stroke the outline, something else -- it
+ is applied to both sides equally, and the comparison tests only that the mark
+ stayed on its base. The test therefore does not depend on the synthesized
+ offset having any particular value.
+ Generated by css/css-text/tools/generate-mark-anchor-font.py. */
+@font-face {
+ font-family: "mark-anchor-test";
+ src: url("../../fonts/mark-anchor-test.ttf") format("truetype");
+}
+div {
+ font-family: "mark-anchor-test";
+ /* Small enough that all three groups fit inside the 800x600 reference
+ viewport, so every bar is actually compared. */
+ font-size: 100px;
+ line-height: 150px;
+ font-weight: bold;
+ font-synthesis: weight;
+ white-space: nowrap;
+}
+</style>
+
+<p>Test passes if every black bar below is exactly as wide as, and left-aligned
+with, the bars above and below it in the same group &mdash; two groups in the
+middle row &mdash; and no bar is offset to the right of the others.</p>
+
+<!-- One base, one mark. -->
+<div>&#x41;&#x301;</div>
+<!-- Two clusters, so any displacement would accumulate across them. -->
+<div>&#x41;&#x301;&#x41;&#x301;</div>
+<!-- Two marks on one base; each takes its position from the same base. -->
+<div>&#x41;&#x301;&#x300;</div>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002.html
new file mode 100644
index 00000000000..a9cf1e4895c
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<title>CSS Fonts test: synthetic bold does not separate a combining mark from its base in RTL</title>
+<link rel="author" title="Brent Fulgham" href="mailto:[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/synthetic-bold-combining-mark-002-ref.html">
+<meta name="assert" content="When a bold weight is synthesized for a family with no bold face, the synthesis must not displace a combining mark relative to the base it is attached to, in a right-to-left run as much as in a left-to-right one.">
+
+<style>
+/* The RTL counterpart of synthetic-bold-combining-mark-001, on Hebrew bases (a
+ genuine RTL run rather than a bidi-override, which would skip bidi rule W1):
+ ALEF is the bottom bar, BET the bottom and middle bars as one glyph, and GIMEL
+ all three. Both sides request bold from a family with only a Regular face, so
+ the synthesis applies equally to each and the comparison tests only that the
+ mark stayed on its base.
+ Generated by css/css-text/tools/generate-mark-anchor-font.py. */
+@font-face {
+ font-family: "mark-anchor-test";
+ src: url("../../fonts/mark-anchor-test.ttf") format("truetype");
+}
+div {
+ font-family: "mark-anchor-test";
+ /* Small enough that all three groups fit inside the 800x600 reference
+ viewport, so every bar is actually compared. */
+ font-size: 100px;
+ line-height: 150px;
+ font-weight: bold;
+ font-synthesis: weight;
+ direction: rtl;
+ white-space: nowrap;
+}
+</style>
+
+<p>Test passes if every black bar below is exactly as wide as, and right-aligned
+with, the bars above and below it in the same group &mdash; two groups in the
+middle row &mdash; and no bar is offset to the left of the others.</p>
+
+<!-- One base, one mark. -->
+<div>&#x5D0;&#x301;</div>
+<!-- Two clusters, so any displacement would accumulate across them. -->
+<div>&#x5D0;&#x301;&#x5D0;&#x301;</div>
+<!-- Two marks on one base; each takes its position from the same base. -->
+<div>&#x5D0;&#x301;&#x300;</div>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range.html
new file mode 100644
index 00000000000..30df5385a50
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Tests that font-weight with value outside of the 'wght' range support by the font does not synthesize bold faces.</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop-desc">
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/7999">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/synthetic-bold-out-of-capabilities-range-ref.html">
+<link rel="assert" title="Tests that of out of the range font-weight values for variable fonts does not cause synthetic bolding.">
+<style>
+ @font-face {
+ font-family: "Inter";
+ src: url('support/fonts/RobotoExtremo-VF-wght-400-500.subset.ttf');
+ }
+ .style900 {
+ font-family: "Inter";
+ font-size: 3em;
+ font-weight: 900;
+ }
+</style>
+
+<p class="style900">text</p>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-space-width.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-space-width.html
new file mode 100644
index 00000000000..edb61c5e260
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-bold-space-width.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+<html lang="en">
+<meta charset="utf-8">
+<link rel="author" title="Myles C. Maxfield" href="[email protected]">
+<link rel="help" href="https://drafts.csswg.org/css-fonts/#missing-weights">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/synthetic-bold-space-width-ref.html">
+<style>
+pre {
+ font: bold 12px 'Monaco';
+}
+</style>
+<body>
+<p>This test passes if the simple and complex text code paths give space characters the same advance under synthetic bold.</p>
+<pre><strong>hi asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf</strong></pre>
+</body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range.html
new file mode 100644
index 00000000000..8a1c6fbee83
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<meta charset="utf-8"/>
+<title>Tests that font-style with angle outside of the 'slnt' range support by the font does not synthesize oblique faces.</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-prop-desc">
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/7999">
+<link rel="match" href="../../../../expected/wpt-import/css/css-fonts/synthetic-oblique-out-of-capabilities-range-ref.html">
+<link rel="assert" title="Tests that of out of the range font-style values for variable fonts does not cause synthetic obliqueing.">
+<style>
+ @font-face {
+ font-family: "Inter";
+ src: url('support/fonts/Inter-VF.subset.ttf');
+ }
+ .style60 {
+ font-family: "Inter";
+ font-size: 3em;
+ font-style: oblique 60deg;
+ }
+</style>
+
+<p class="style60">text</p>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-bold.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-bold.html
new file mode 100644
index 00000000000..f4053ff9b49
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-bold.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Test: Test for synthetic bold rendering</title>
+ <link rel="author" title="Mozilla" href="http://www.mozilla.com/" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#propdef-font-weight" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#font-boldness" />
+ <link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-weight-prop" />
+ <link rel="mismatch" href="../../../../expected/wpt-import/css/css-fonts/test-synthetic-bold-notref.html" />
+ <meta name="assert" content="Synthetic bold text should render differently than normal text" />
+ <style type="text/css">
+ div { font-size: 36px; }
+ span#verify { font-family: "CSSTest Verify"; }
+ div#test1 {
+ font-family: CSSTest Verify;
+ }
+ div#test2 {
+ font-family: CSSTest Verify;
+ font-weight: bold;
+ }
+ </style>
+ </head>
+ <body>
+ <div><a href="http://www.w3.org/Style/CSS/Test/Fonts/">Test fonts</a> must be installed for this test: <span id="verify">FAIL</span></div>
+ <p>Browser supports synthetic bolding if PASS appears on both lines and the second line appears bolder:</p>
+ <div id="test1">FAIL</div>
+ <div id="test2">FAIL</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-italic.html b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-italic.html
new file mode 100644
index 00000000000..05938e7882e
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/wpt-import/css/css-fonts/test-synthetic-italic.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>CSS Test: Test for synthetic italic rendering</title>
+ <link rel="author" title="Mozilla" href="http://www.mozilla.com/" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#propdef-font-style" />
+ <link rel="help" href="http://www.w3.org/TR/CSS21/fonts.html#font-styling" />
+ <link rel="help" href="http://www.w3.org/TR/css-fonts-3/#font-style-prop"/>
+ <link rel="mismatch" href="../../../../expected/wpt-import/css/css-fonts/test-synthetic-italic-notref.html" />
+ <meta name="assert" content="Synthetic italic text should render differently than normal text" />
+ <style type="text/css">
+ div { font-size: 36px; }
+ span#verify {font-family: "CSSTest Verify";}
+ div#test1 {
+ font-family: CSSTest Verify;
+ }
+ div#test2 {
+ font-family: CSSTest Verify;
+ font-style: italic;
+ }
+ </style>
+ </head>
+ <body>
+ <div><a href="http://www.w3.org/Style/CSS/Test/Fonts/">Test fonts</a> must be installed for this test: <span id="verify">FAIL</span></div>
+ <p>Browser supports synthetic italics if PASS appears on both lines and the second line is slanted right:</p>
+ <div id="test1">FAIL</div>
+ <div id="test2">FAIL</div>
+ </body>
+</html>
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Bold.ttf b/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Bold.ttf
new file mode 100644
index 00000000000..016068b486e
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Bold.ttf differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Medium.ttf b/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Medium.ttf
new file mode 100644
index 00000000000..2c612da2ae5
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/Lato-Medium.ttf differ
diff --git a/Tests/LibWeb/Ref/input/wpt-import/fonts/mark-anchor-test.ttf b/Tests/LibWeb/Ref/input/wpt-import/fonts/mark-anchor-test.ttf
new file mode 100644
index 00000000000..03def55fa9a
Binary files /dev/null and b/Tests/LibWeb/Ref/input/wpt-import/fonts/mark-anchor-test.ttf differ
diff --git a/Tests/LibWeb/Screenshot/expected-macos/video-object-fit.png b/Tests/LibWeb/Screenshot/expected-macos/video-object-fit.png
index b77e560d030..f2cc302f0e1 100644
Binary files a/Tests/LibWeb/Screenshot/expected-macos/video-object-fit.png and b/Tests/LibWeb/Screenshot/expected-macos/video-object-fit.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/css-background-clip-text.png b/Tests/LibWeb/Screenshot/expected/css-background-clip-text.png
index 40bbe756d4f..24c4fa008e4 100644
Binary files a/Tests/LibWeb/Screenshot/expected/css-background-clip-text.png and b/Tests/LibWeb/Screenshot/expected/css-background-clip-text.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/object-fit-position.png b/Tests/LibWeb/Screenshot/expected/object-fit-position.png
index ec97352c453..9cab7bc2619 100644
Binary files a/Tests/LibWeb/Screenshot/expected/object-fit-position.png and b/Tests/LibWeb/Screenshot/expected/object-fit-position.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/svg-text-effects.png b/Tests/LibWeb/Screenshot/expected/svg-text-effects.png
index 7d786f3a412..cb3fdf9d44c 100644
Binary files a/Tests/LibWeb/Screenshot/expected/svg-text-effects.png and b/Tests/LibWeb/Screenshot/expected/svg-text-effects.png differ
diff --git a/Tests/LibWeb/Screenshot/expected/video-object-fit.png b/Tests/LibWeb/Screenshot/expected/video-object-fit.png
index 875cf377362..0a7977e357c 100644
Binary files a/Tests/LibWeb/Screenshot/expected/video-object-fit.png and b/Tests/LibWeb/Screenshot/expected/video-object-fit.png differ
diff --git a/Tests/LibWeb/Text/expected/canvas/2d-measure-text.txt b/Tests/LibWeb/Text/expected/canvas/2d-measure-text.txt
index c230dc9a484..a7e92c3f15b 100644
--- a/Tests/LibWeb/Text/expected/canvas/2d-measure-text.txt
+++ b/Tests/LibWeb/Text/expected/canvas/2d-measure-text.txt
@@ -23,10 +23,10 @@ A canvas:
italic 9px sans-serif
"": 0, 0, 0, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
" ": 4.5, 0, 4.5, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "Hello, world!": 55.78125, -0.53125, 55.28125, 7.1982421875, 1.8017578125, 6.546875, 0.390625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "a\tb\nc\fd\re": 42.90625, -0.078125, 42.40625, 7.1982421875, 1.8017578125, 6.515625, 0.0625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "é😀漢字 mixed": 49.96875, -0.296875, 49.375, 7.1982421875, 1.8017578125, 7.609375, 1.46875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "\ud800 lone": 26.296875, -0.296875, 25.796875, 7.1982421875, 1.8017578125, 5.984375, 0.421875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "Hello, world!": 55.78125, -0.59375, 56.921875, 7.1982421875, 1.8017578125, 6.546875, 0.390625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "a\tb\nc\fd\re": 42.90625, -0.046875, 43.625, 7.1982421875, 1.8017578125, 6.515625, 0.0625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "é😀漢字 mixed": 49.96875, -0.296875, 50.59375, 7.1982421875, 1.8017578125, 7.609375, 1.46875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "\ud800 lone": 26.296875, -0.296875, 27.015625, 7.1982421875, 1.8017578125, 5.984375, 0.421875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
textBaseline top
"Baseline": 59.90625, -0.90625, 59.078125, 0, 15, -0.7314453125, 12.7001953125, 0, 15, -2.3994140625, -11.9970703125, -15
textBaseline hanging
@@ -80,10 +80,10 @@ An OffscreenCanvas:
italic 9px sans-serif
"": 0, 0, 0, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
" ": 4.5, 0, 4.5, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "Hello, world!": 55.78125, -0.53125, 55.28125, 7.1982421875, 1.8017578125, 6.546875, 0.390625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "a\tb\nc\fd\re": 42.90625, -0.078125, 42.40625, 7.1982421875, 1.8017578125, 6.515625, 0.0625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "é😀漢字 mixed": 49.96875, -0.296875, 49.375, 7.1982421875, 1.8017578125, 7.609375, 1.46875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
- "\ud800 lone": 26.296875, -0.296875, 25.796875, 7.1982421875, 1.8017578125, 5.984375, 0.421875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "Hello, world!": 55.78125, -0.59375, 56.921875, 7.1982421875, 1.8017578125, 6.546875, 0.390625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "a\tb\nc\fd\re": 42.90625, -0.046875, 43.625, 7.1982421875, 1.8017578125, 6.515625, 0.0625, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "é😀漢字 mixed": 49.96875, -0.296875, 50.59375, 7.1982421875, 1.8017578125, 7.609375, 1.46875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
+ "\ud800 lone": 26.296875, -0.296875, 27.015625, 7.1982421875, 1.8017578125, 5.984375, 0.421875, 7.1982421875, 1.8017578125, 5.758594036102295, 0, -1.8017578125
textBaseline top
"Baseline": 59.90625, -0.90625, 59.078125, 0, 15, -0.7314453125, 12.7001953125, 0, 15, -2.3994140625, -11.9970703125, -15
textBaseline hanging
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.txt
new file mode 100644
index 00000000000..bf74fde5ef5
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.txt
@@ -0,0 +1,8 @@
+Harness status: OK
+
+Found 3 tests
+
+3 Pass
+Pass Synthetic bold does not widen a run of inked glyphs
+Pass Synthetic bold does not widen a run of U+0020 spaces
+Pass Synthetic bold does not widen a run of U+00A0 no-break spaces
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.txt
new file mode 100644
index 00000000000..f8cfef354ac
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.txt
@@ -0,0 +1,6 @@
+Harness status: OK
+
+Found 1 tests
+
+1 Pass
+Pass Synthetic bold does not give width to a zero-advance (empty) font
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.html
new file mode 100644
index 00000000000..236cf1ce102
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-does-not-widen-advances.html
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Synthetic bold must not change a run's measured advance width</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+@font-face {
+ /* Ahem has only a Regular face and every glyph advances exactly 1em, so at
+ font-size:100px an N-character run is exactly N*100px wide. Asking for
+ bold leaves the UA no bold face to use, so it synthesizes bold.
+ Deliberately not using an Ahem font that includes a bold face, since
+ a real bold face would switch synthesis off, making this test worthless. */
+ font-family: "SyntheticBoldAdvanceTest";
+ src: url("../../fonts/Ahem.ttf") format("truetype");
+}
+</style>
+<body>
+<script>
+// Emboldening is a painting effect: it must not change how wide the text
+// measures. The offset still belongs in painting and ink bounds; it must
+// not be included in the advance.
+function runWidth(text, weight, whiteSpace) {
+ const span = document.createElement("span");
+ span.style.cssText = "position:absolute; top:-9999px; left:0;"
+ + " display:inline-block; font-family:'SyntheticBoldAdvanceTest';"
+ + " font-size:100px; white-space:" + whiteSpace + "; font-weight:" + weight;
+ span.textContent = text;
+ document.body.appendChild(span);
+ const width = span.getBoundingClientRect().width;
+ span.remove();
+ return width;
+}
+
+async function loadTestFont() {
+ await document.fonts.load("100px SyntheticBoldAdvanceTest");
+ await document.fonts.ready;
+ assert_true(document.fonts.check("100px SyntheticBoldAdvanceTest"),
+ "the single-weight test font loaded");
+}
+
+// A run of only spaces needs white-space:pre; with nowrap it collapses to 0px
+// and the comparison below would hold vacuously.
+function widthTest(text, whiteSpace, description) {
+ promise_test(async () => {
+ await loadTestFont();
+ const normal = runWidth(text, "normal", whiteSpace);
+ assert_equals(normal, text.length * 100,
+ "sanity: at normal weight the run is 1em per glyph");
+ assert_equals(runWidth(text, "bold", whiteSpace), normal,
+ "synthesizing bold must not change the measured advance width");
+ }, description);
+}
+
+widthTest("X".repeat(20), "nowrap",
+ "Synthetic bold does not widen a run of inked glyphs");
+widthTest(" ".repeat(20), "pre",
+ "Synthetic bold does not widen a run of U+0020 spaces");
+widthTest("\u00a0".repeat(20), "nowrap",
+ "Synthetic bold does not widen a run of U+00A0 no-break spaces");
+</script>
+</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.html b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.html
new file mode 100644
index 00000000000..ac573e47341
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/css-fonts/synthetic-bold-zero-advance-glyph.html
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Synthetic bold must not add advance to zero-advance glyphs</title>
+<link rel="help" href="https://drafts.csswg.org/css-fonts-4/#font-synthesis-weight">
+<link rel="help" href="https://www.w3.org/TR/css-text-3/#letter-spacing-property">
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<style>
+@font-face {
+ /* resources/ChTestZeroWidthZero.woff has only a Regular face; U+0030 '0'
+ maps to a glyph whose advance width is 0, so any run of '0' is 0px wide.
+ Requesting bold has no bold face to use, so the UA synthesizes bold. */
+ font-family: "ChTestZeroWidthZero";
+ src: url("../css-values/resources/ChTestZeroWidthZero.woff") format("woff");
+}
+</style>
+<body>
+<script>
+// Lay out 100 zero-advance glyphs at the given weight and return the run width.
+// With no bold face present, the bold run gets synthetic bold; without the fix
+// each glyph was padded by font-size/36, making the run non-zero wide instead
+// of 0. A zero-advance glyph draws in place and must not advance the pen.
+function runWidth(weight) {
+ const span = document.createElement("span");
+ span.style.cssText = "display:inline-block; font-family:'ChTestZeroWidthZero';"
+ + " font-size:50px; white-space:nowrap; font-weight:" + weight;
+ span.textContent = "0".repeat(100);
+ document.body.appendChild(span);
+ const width = span.getBoundingClientRect().width;
+ span.remove();
+ return width;
+}
+
+promise_test(async () => {
+ await document.fonts.load("50px ChTestZeroWidthZero");
+ await document.fonts.ready;
+ assert_true(document.fonts.check("50px ChTestZeroWidthZero"), "the zero-advance font loaded");
+
+ assert_equals(runWidth("normal"), 0, "a run of zero-advance glyphs is 0px wide");
+ assert_equals(runWidth("bold"), 0, "synthetic bold must not add advance to zero-advance glyphs");
+}, "Synthetic bold does not give width to a zero-advance (empty) font");
+</script>
+</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/css-values/resources/ChTestZeroWidthZero.woff b/Tests/LibWeb/Text/input/wpt-import/css/css-values/resources/ChTestZeroWidthZero.woff
new file mode 100644
index 00000000000..9c34dda475f
Binary files /dev/null and b/Tests/LibWeb/Text/input/wpt-import/css/css-values/resources/ChTestZeroWidthZero.woff differ
diff --git a/Tests/LibWeb/Text/input/wpt-import/fonts/Ahem.ttf.headers b/Tests/LibWeb/Text/input/wpt-import/fonts/Ahem.ttf.headers
new file mode 100644
index 00000000000..6a0df8b1f53
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/fonts/Ahem.ttf.headers
@@ -0,0 +1,3 @@
+Access-Control-Allow-Origin: *
+Cache-Control: max-age=3600
+Timing-Allow-Origin: *