mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 07:51:10 +01:00
[raster] Churn callsites to hb_svg_str_t ASCII-ci methods
This commit is contained in:
1 parent
5a3e4a7750
commit
b3a0ce0e16
8 files changed
+84
-98
No files matched your search
+50
-62
@@ -29,18 +29,6 @@
|
||||
#include "hb-raster-svg-base.hh"
|
||||
#include "hb-raster-svg-parse.hh"
|
||||
|
||||
bool
|
||||
svg_str_eq_ascii_ci (hb_svg_str_t s, const char *lit)
|
||||
{
|
||||
return s.eq_ascii_ci (lit);
|
||||
}
|
||||
|
||||
bool
|
||||
svg_str_starts_with_ascii_ci (hb_svg_str_t s, const char *lit)
|
||||
{
|
||||
return s.starts_with_ascii_ci (lit);
|
||||
}
|
||||
|
||||
void
|
||||
svg_parse_style_props (hb_svg_str_t style, hb_svg_style_props_t *out)
|
||||
{
|
||||
@@ -78,41 +66,41 @@ svg_parse_style_props (hb_svg_str_t style, hb_svg_style_props_t *out)
|
||||
|
||||
hb_svg_str_t prop_name = {name_start, (unsigned) (name_end - name_start)};
|
||||
hb_svg_str_t prop_value = {value_start, (unsigned) (value_end - value_start)};
|
||||
if (svg_str_eq_ascii_ci (prop_name, "fill")) out->fill = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "fill-opacity")) out->fill_opacity = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "opacity")) out->opacity = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "transform")) out->transform = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "clip-path")) out->clip_path = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "display")) out->display = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "color")) out->color = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "visibility")) out->visibility = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "offset")) out->offset = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "stop-color")) out->stop_color = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "stop-opacity")) out->stop_opacity = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "spreadmethod") ||
|
||||
svg_str_eq_ascii_ci (prop_name, "spread-method")) out->spread_method = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "gradientunits") ||
|
||||
svg_str_eq_ascii_ci (prop_name, "gradient-units")) out->gradient_units = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "gradienttransform") ||
|
||||
svg_str_eq_ascii_ci (prop_name, "gradient-transform")) out->gradient_transform = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "x")) out->x = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "y")) out->y = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "width")) out->width = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "height")) out->height = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "cx")) out->cx = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "cy")) out->cy = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "r")) out->r = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "fx")) out->fx = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "fy")) out->fy = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "fr")) out->fr = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "rx")) out->rx = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "ry")) out->ry = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "x1")) out->x1 = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "y1")) out->y1 = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "x2")) out->x2 = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "y2")) out->y2 = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "points")) out->points = prop_value;
|
||||
else if (svg_str_eq_ascii_ci (prop_name, "d")) out->d = prop_value;
|
||||
if (prop_name.eq_ascii_ci ("fill")) out->fill = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("fill-opacity")) out->fill_opacity = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("opacity")) out->opacity = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("transform")) out->transform = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("clip-path")) out->clip_path = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("display")) out->display = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("color")) out->color = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("visibility")) out->visibility = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("offset")) out->offset = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("stop-color")) out->stop_color = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("stop-opacity")) out->stop_opacity = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("spreadmethod") ||
|
||||
prop_name.eq_ascii_ci ("spread-method")) out->spread_method = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("gradientunits") ||
|
||||
prop_name.eq_ascii_ci ("gradient-units")) out->gradient_units = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("gradienttransform") ||
|
||||
prop_name.eq_ascii_ci ("gradient-transform")) out->gradient_transform = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("x")) out->x = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("y")) out->y = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("width")) out->width = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("height")) out->height = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("cx")) out->cx = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("cy")) out->cy = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("r")) out->r = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("fx")) out->fx = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("fy")) out->fy = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("fr")) out->fr = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("rx")) out->rx = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("ry")) out->ry = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("x1")) out->x1 = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("y1")) out->y1 = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("x2")) out->x2 = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("y2")) out->y2 = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("points")) out->points = prop_value;
|
||||
else if (prop_name.eq_ascii_ci ("d")) out->d = prop_value;
|
||||
|
||||
if (p < end && *p == ';') p++;
|
||||
}
|
||||
@@ -161,7 +149,7 @@ hb_raster_svg_parse_id_ref (hb_svg_str_t s,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!svg_str_starts_with_ascii_ci (s, "url("))
|
||||
if (!s.starts_with_ascii_ci ("url("))
|
||||
return false;
|
||||
|
||||
const char *p = s.data + 4;
|
||||
@@ -235,7 +223,7 @@ hb_raster_svg_parse_local_id_ref (hb_svg_str_t s,
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!svg_str_starts_with_ascii_ci (s, "url("))
|
||||
if (!s.starts_with_ascii_ci ("url("))
|
||||
return false;
|
||||
|
||||
hb_svg_str_t id;
|
||||
@@ -330,15 +318,15 @@ svg_align_offset (hb_svg_str_t align,
|
||||
char axis)
|
||||
{
|
||||
if (leftover <= 0.f) return 0.f;
|
||||
if ((axis == 'x' && svg_str_starts_with_ascii_ci (align, "xMin")) ||
|
||||
(axis == 'y' && (svg_str_eq_ascii_ci (align, "xMinYMin") ||
|
||||
svg_str_eq_ascii_ci (align, "xMidYMin") ||
|
||||
svg_str_eq_ascii_ci (align, "xMaxYMin"))))
|
||||
if ((axis == 'x' && align.starts_with_ascii_ci ("xMin")) ||
|
||||
(axis == 'y' && (align.eq_ascii_ci ("xMinYMin") ||
|
||||
align.eq_ascii_ci ("xMidYMin") ||
|
||||
align.eq_ascii_ci ("xMaxYMin"))))
|
||||
return 0.f;
|
||||
if ((axis == 'x' && svg_str_starts_with_ascii_ci (align, "xMax")) ||
|
||||
(axis == 'y' && (svg_str_eq_ascii_ci (align, "xMinYMax") ||
|
||||
svg_str_eq_ascii_ci (align, "xMidYMax") ||
|
||||
svg_str_eq_ascii_ci (align, "xMaxYMax"))))
|
||||
if ((axis == 'x' && align.starts_with_ascii_ci ("xMax")) ||
|
||||
(axis == 'y' && (align.eq_ascii_ci ("xMinYMax") ||
|
||||
align.eq_ascii_ci ("xMidYMax") ||
|
||||
align.eq_ascii_ci ("xMaxYMax"))))
|
||||
return leftover;
|
||||
return leftover * 0.5f;
|
||||
}
|
||||
@@ -357,7 +345,7 @@ hb_raster_svg_compute_viewbox_transform (float viewport_w,
|
||||
return false;
|
||||
|
||||
hb_svg_str_t par = preserve_aspect_ratio.trim ();
|
||||
if (svg_str_starts_with_ascii_ci (par, "defer"))
|
||||
if (par.starts_with_ascii_ci ("defer"))
|
||||
{
|
||||
const char *p = par.data + 5;
|
||||
const char *end = par.data + par.len;
|
||||
@@ -375,13 +363,13 @@ hb_raster_svg_compute_viewbox_transform (float viewport_w,
|
||||
while (p < end && *p != ' ' && *p != '\t' && *p != '\n' && *p != '\r') p++;
|
||||
align = hb_svg_str_t (par.data, (unsigned) (p - par.data)).trim ();
|
||||
|
||||
if (svg_str_starts_with_ascii_ci (par, "none"))
|
||||
if (par.starts_with_ascii_ci ("none"))
|
||||
is_none = true;
|
||||
else if (svg_str_starts_with_ascii_ci (align, "x"))
|
||||
else if (align.starts_with_ascii_ci ("x"))
|
||||
{
|
||||
const char *mode = p;
|
||||
while (mode < end && (*mode == ' ' || *mode == '\t' || *mode == '\n' || *mode == '\r')) mode++;
|
||||
if (mode < end && svg_str_starts_with_ascii_ci (hb_svg_str_t (mode, (unsigned) (end - mode)), "slice"))
|
||||
if (mode < end && hb_svg_str_t (mode, (unsigned) (end - mode)).starts_with_ascii_ci ("slice"))
|
||||
is_slice = true;
|
||||
}
|
||||
|
||||
@@ -404,7 +392,7 @@ hb_raster_svg_compute_viewbox_transform (float viewport_w,
|
||||
float leftover_x = viewport_w - scaled_w;
|
||||
float leftover_y = viewport_h - scaled_h;
|
||||
|
||||
if (!svg_str_starts_with_ascii_ci (align, "x"))
|
||||
if (!align.starts_with_ascii_ci ("x"))
|
||||
align = hb_svg_str_t ("xMidYMid", 8);
|
||||
|
||||
t.xx = s;
|
||||
|
||||
@@ -156,8 +156,6 @@ struct hb_svg_style_props_t
|
||||
struct hb_svg_xml_parser_t;
|
||||
struct hb_svg_transform_t;
|
||||
|
||||
HB_INTERNAL bool svg_str_eq_ascii_ci (hb_svg_str_t s, const char *lit);
|
||||
HB_INTERNAL bool svg_str_starts_with_ascii_ci (hb_svg_str_t s, const char *lit);
|
||||
HB_INTERNAL void svg_parse_style_props (hb_svg_str_t style, hb_svg_style_props_t *out);
|
||||
HB_INTERNAL float svg_parse_number_or_percent (hb_svg_str_t s, bool *is_percent);
|
||||
HB_INTERNAL hb_svg_str_t hb_raster_svg_find_href_attr (const hb_svg_xml_parser_t &parser);
|
||||
@@ -205,13 +203,13 @@ svg_parse_float_clamped01 (hb_svg_str_t s)
|
||||
static inline bool
|
||||
svg_str_is_inherit (hb_svg_str_t s)
|
||||
{
|
||||
return svg_str_eq_ascii_ci (s.trim (), "inherit");
|
||||
return s.trim ().eq_ascii_ci ("inherit");
|
||||
}
|
||||
|
||||
static inline bool
|
||||
svg_str_is_none (hb_svg_str_t s)
|
||||
{
|
||||
return svg_str_eq_ascii_ci (s.trim (), "none");
|
||||
return s.trim ().eq_ascii_ci ("none");
|
||||
}
|
||||
|
||||
static inline bool
|
||||
|
||||
@@ -109,15 +109,15 @@ svg_resolve_element_visibility (hb_svg_xml_parser_t &parser,
|
||||
svg_parse_style_props (parser.find_attr ("style"), &style_props);
|
||||
hb_svg_str_t display_str = svg_pick_attr_or_style (parser, style_props.display, "display");
|
||||
hb_svg_str_t visibility_str = svg_pick_attr_or_style (parser, style_props.visibility, "visibility");
|
||||
if (svg_str_eq_ascii_ci (display_str.trim (), "none"))
|
||||
if (display_str.trim ().eq_ascii_ci ("none"))
|
||||
return false;
|
||||
hb_svg_str_t vis_trim = visibility_str.trim ();
|
||||
if (!vis_trim.len || svg_str_eq_ascii_ci (vis_trim, "inherit"))
|
||||
if (!vis_trim.len || vis_trim.eq_ascii_ci ("inherit"))
|
||||
return parent_visible;
|
||||
if (svg_str_eq_ascii_ci (vis_trim, "hidden") ||
|
||||
svg_str_eq_ascii_ci (vis_trim, "collapse"))
|
||||
if (vis_trim.eq_ascii_ci ("hidden") ||
|
||||
vis_trim.eq_ascii_ci ("collapse"))
|
||||
return false;
|
||||
if (svg_str_eq_ascii_ci (vis_trim, "visible"))
|
||||
if (vis_trim.eq_ascii_ci ("visible"))
|
||||
return true;
|
||||
return parent_visible;
|
||||
}
|
||||
@@ -321,9 +321,9 @@ hb_raster_svg_process_clip_path_def (hb_svg_defs_t *defs,
|
||||
hb_svg_clip_path_def_t clip;
|
||||
hb_svg_str_t id = parser.find_attr ("id");
|
||||
hb_svg_str_t units = parser.find_attr ("clipPathUnits").trim ();
|
||||
if (svg_str_eq_ascii_ci (units, "objectBoundingBox"))
|
||||
if (units.eq_ascii_ci ("objectBoundingBox"))
|
||||
clip.units_user_space = false;
|
||||
else if (svg_str_eq_ascii_ci (units, "userSpaceOnUse"))
|
||||
else if (units.eq_ascii_ci ("userSpaceOnUse"))
|
||||
clip.units_user_space = true;
|
||||
else
|
||||
clip.units_user_space = true;
|
||||
@@ -507,7 +507,7 @@ hb_raster_svg_push_clip_path_ref (hb_raster_paint_t *paint,
|
||||
{
|
||||
if (clip_path_str.is_null ()) return false;
|
||||
hb_svg_str_t trimmed = clip_path_str.trim ();
|
||||
if (!trimmed.len || svg_str_eq_ascii_ci (trimmed, "none")) return false;
|
||||
if (!trimmed.len || trimmed.eq_ascii_ci ("none")) return false;
|
||||
|
||||
hb_svg_str_t clip_id;
|
||||
if (!hb_raster_svg_parse_local_id_ref (trimmed, &clip_id, nullptr))
|
||||
|
||||
@@ -216,17 +216,17 @@ hb_raster_svg_parse_color (hb_svg_str_t s,
|
||||
s = s.trim ();
|
||||
if (!s.len) { *is_none = true; return HB_COLOR (0, 0, 0, 0); }
|
||||
|
||||
if (svg_str_eq_ascii_ci (s, "none") || svg_str_eq_ascii_ci (s, "transparent"))
|
||||
if (s.eq_ascii_ci ("none") || s.eq_ascii_ci ("transparent"))
|
||||
{
|
||||
*is_none = true;
|
||||
return HB_COLOR (0, 0, 0, 0);
|
||||
}
|
||||
|
||||
if (svg_str_eq_ascii_ci (s, "currentColor"))
|
||||
if (s.eq_ascii_ci ("currentColor"))
|
||||
return foreground;
|
||||
|
||||
/* var(--colorN) → CPAL palette color */
|
||||
if (svg_str_starts_with_ascii_ci (s, "var("))
|
||||
if (s.starts_with_ascii_ci ("var("))
|
||||
{
|
||||
const char *p = s.data + 4;
|
||||
const char *e = s.data + s.len;
|
||||
|
||||
@@ -104,7 +104,7 @@ svg_parse_paint_url_with_fallback (hb_svg_str_t s,
|
||||
hb_svg_str_t id;
|
||||
if (!hb_raster_svg_parse_local_id_ref (s, &id, fallback))
|
||||
return false;
|
||||
if (!svg_str_starts_with_ascii_ci (s.trim (), "url("))
|
||||
if (!s.trim ().starts_with_ascii_ci ("url("))
|
||||
return false;
|
||||
if (out_id) *out_id = id;
|
||||
return id.len > 0;
|
||||
|
||||
@@ -53,11 +53,11 @@ svg_parse_gradient_stop (hb_svg_xml_parser_t &parser,
|
||||
hb_svg_str_t display_str = svg_pick_attr_or_style (parser, style_props.display, "display");
|
||||
hb_svg_str_t visibility_str = svg_pick_attr_or_style (parser, style_props.visibility, "visibility");
|
||||
|
||||
if (svg_str_eq_ascii_ci (display_str.trim (), "none"))
|
||||
if (display_str.trim ().eq_ascii_ci ("none"))
|
||||
return true;
|
||||
hb_svg_str_t visibility_trim = visibility_str.trim ();
|
||||
if (svg_str_eq_ascii_ci (visibility_trim, "hidden") ||
|
||||
svg_str_eq_ascii_ci (visibility_trim, "collapse"))
|
||||
if (visibility_trim.eq_ascii_ci ("hidden") ||
|
||||
visibility_trim.eq_ascii_ci ("collapse"))
|
||||
return true;
|
||||
|
||||
float offset = 0;
|
||||
@@ -71,7 +71,7 @@ svg_parse_gradient_stop (hb_svg_xml_parser_t &parser,
|
||||
bool is_current_color = false;
|
||||
if (color_str.len && !svg_str_is_inherit (color_str))
|
||||
{
|
||||
is_current_color = svg_str_eq_ascii_ci (color_str.trim (), "currentColor");
|
||||
is_current_color = color_str.trim ().eq_ascii_ci ("currentColor");
|
||||
color = hb_raster_svg_parse_color (color_str, pfuncs, paint_data, foreground, face, palette, &is_none);
|
||||
}
|
||||
|
||||
@@ -100,29 +100,29 @@ svg_parse_gradient_attrs (hb_svg_xml_parser_t &parser,
|
||||
svg_parse_style_props (parser.find_attr ("style"), &style_props);
|
||||
|
||||
hb_svg_str_t spread_str = svg_pick_attr_or_style (parser, style_props.spread_method, "spreadMethod").trim ();
|
||||
if (svg_str_eq_ascii_ci (spread_str, "reflect"))
|
||||
if (spread_str.eq_ascii_ci ("reflect"))
|
||||
{
|
||||
grad.spread = HB_PAINT_EXTEND_REFLECT;
|
||||
grad.has_spread = true;
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (spread_str, "repeat"))
|
||||
else if (spread_str.eq_ascii_ci ("repeat"))
|
||||
{
|
||||
grad.spread = HB_PAINT_EXTEND_REPEAT;
|
||||
grad.has_spread = true;
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (spread_str, "pad"))
|
||||
else if (spread_str.eq_ascii_ci ("pad"))
|
||||
{
|
||||
grad.spread = HB_PAINT_EXTEND_PAD;
|
||||
grad.has_spread = true;
|
||||
}
|
||||
|
||||
hb_svg_str_t units_str = svg_pick_attr_or_style (parser, style_props.gradient_units, "gradientUnits").trim ();
|
||||
if (svg_str_eq_ascii_ci (units_str, "userSpaceOnUse"))
|
||||
if (units_str.eq_ascii_ci ("userSpaceOnUse"))
|
||||
{
|
||||
grad.units_user_space = true;
|
||||
grad.has_units_user_space = true;
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (units_str, "objectBoundingBox"))
|
||||
else if (units_str.eq_ascii_ci ("objectBoundingBox"))
|
||||
{
|
||||
grad.units_user_space = false;
|
||||
grad.has_units_user_space = true;
|
||||
|
||||
@@ -52,7 +52,7 @@ hb_raster_svg_parse_transform (hb_svg_str_t s, hb_svg_transform_t *out)
|
||||
|
||||
hb_svg_transform_t t;
|
||||
|
||||
if (svg_str_eq_ascii_ci (func_name, "matrix"))
|
||||
if (func_name.eq_ascii_ci ("matrix"))
|
||||
{
|
||||
t.xx = fp.next_float ();
|
||||
t.yx = fp.next_float ();
|
||||
@@ -61,14 +61,14 @@ hb_raster_svg_parse_transform (hb_svg_str_t s, hb_svg_transform_t *out)
|
||||
t.dx = fp.next_float ();
|
||||
t.dy = fp.next_float ();
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (func_name, "translate"))
|
||||
else if (func_name.eq_ascii_ci ("translate"))
|
||||
{
|
||||
t.dx = fp.next_float ();
|
||||
fp.skip_ws_comma ();
|
||||
if (fp.p < fp.end && *fp.p != ')')
|
||||
t.dy = fp.next_float ();
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (func_name, "scale"))
|
||||
else if (func_name.eq_ascii_ci ("scale"))
|
||||
{
|
||||
t.xx = fp.next_float ();
|
||||
fp.skip_ws_comma ();
|
||||
@@ -77,7 +77,7 @@ hb_raster_svg_parse_transform (hb_svg_str_t s, hb_svg_transform_t *out)
|
||||
else
|
||||
t.yy = t.xx;
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (func_name, "rotate"))
|
||||
else if (func_name.eq_ascii_ci ("rotate"))
|
||||
{
|
||||
float angle = fp.next_float () * (float) M_PI / 180.f;
|
||||
float cs = cosf (angle), sn = sinf (angle);
|
||||
@@ -97,12 +97,12 @@ hb_raster_svg_parse_transform (hb_svg_str_t s, hb_svg_transform_t *out)
|
||||
t.xy = -sn; t.yy = cs;
|
||||
}
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (func_name, "skewX"))
|
||||
else if (func_name.eq_ascii_ci ("skewX"))
|
||||
{
|
||||
float angle = fp.next_float () * (float) M_PI / 180.f;
|
||||
t.xy = tanf (angle);
|
||||
}
|
||||
else if (svg_str_eq_ascii_ci (func_name, "skewY"))
|
||||
else if (func_name.eq_ascii_ci ("skewY"))
|
||||
{
|
||||
float angle = fp.next_float () * (float) M_PI / 180.f;
|
||||
t.yx = tanf (angle);
|
||||
|
||||
@@ -353,17 +353,17 @@ svg_render_element (hb_svg_render_context_t *ctx,
|
||||
transform_str = {};
|
||||
state.color = inherited.color;
|
||||
bool is_none = false;
|
||||
if (color_str.len && !svg_str_eq_ascii_ci (color_str.trim (), "inherit"))
|
||||
if (color_str.len && !color_str.trim ().eq_ascii_ci ("inherit"))
|
||||
state.color = hb_raster_svg_parse_color (color_str, ctx->pfuncs, ctx->paint,
|
||||
inherited.color, hb_font_get_face (ctx->font),
|
||||
ctx->palette, &is_none);
|
||||
state.visibility = inherited.visibility;
|
||||
hb_svg_str_t visibility_trim = visibility_str.trim ();
|
||||
if (visibility_trim.len && !svg_str_eq_ascii_ci (visibility_trim, "inherit"))
|
||||
state.visibility = !(svg_str_eq_ascii_ci (visibility_trim, "hidden") ||
|
||||
svg_str_eq_ascii_ci (visibility_trim, "collapse"));
|
||||
if (visibility_trim.len && !visibility_trim.eq_ascii_ci ("inherit"))
|
||||
state.visibility = !(visibility_trim.eq_ascii_ci ("hidden") ||
|
||||
visibility_trim.eq_ascii_ci ("collapse"));
|
||||
|
||||
if (svg_str_eq_ascii_ci (display_str.trim (), "none"))
|
||||
if (display_str.trim ().eq_ascii_ci ("none"))
|
||||
{
|
||||
if (!self_closing)
|
||||
svg_skip_subtree (parser);
|
||||
|
||||
Reference in new issue
Block a user