Unify view extents defaults

This commit is contained in:
Behdad Esfahbod committed 2026-03-03 17:19:15 -03:00
1 parent ce292d3c10
commit c2efaa5ced
5 files changed
+10 -9

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@
#include "shape-consumer.hh"
#include "text-options.hh"
const unsigned DEFAULT_FONT_SIZE = 256;
const unsigned DEFAULT_FONT_SIZE = FONT_SIZE_UPEM;
const unsigned SUBPIXEL_BITS = 6;
int
+2 -2
View File
@@ -455,8 +455,8 @@ struct raster_output_t : output_options_t<true>, view_options_t
bool compute_extents (float sx, float sy, float step, bool vertical, hb_raster_extents_t *ext)
{
/* Compute bounding box in pixel space from logical and/or ink extents. */
const bool include_logical = logical || !ink;
const bool include_ink = ink || !logical;
const bool include_logical = include_logical_extents ();
const bool include_ink = include_ink_extents ();
float pmin_x = 1e30f, pmin_y = 1e30f;
float pmax_x = -1e30f, pmax_y = -1e30f;
+3 -4
View File
@@ -197,8 +197,7 @@ struct vector_output_t : output_options_t<>, view_options_t
bool had_draw = false;
bool had_paint = false;
hb_vector_extents_mode_t extents_mode = ink ? HB_VECTOR_EXTENTS_MODE_EXPAND
: HB_VECTOR_EXTENTS_MODE_NONE;
hb_vector_extents_mode_t extents_mode = HB_VECTOR_EXTENTS_MODE_NONE;
const bool use_foreground_palette =
foreground_use_palette && foreground_palette && foreground_palette->len;
unsigned palette_glyph_index = 0;
@@ -320,8 +319,8 @@ struct vector_output_t : output_options_t<>, view_options_t
bool valid = false;
float x1 = 0, y1 = 0, x2 = 0, y2 = 0;
bool include_logical = logical || (!logical && !ink);
bool include_ink = ink;
bool include_logical = include_logical_extents ();
bool include_ink = include_ink_extents ();
auto include_point = [&] (float x, float y)
{
+2 -2
View File
@@ -239,8 +239,8 @@ view_cairo_t::render (const font_options_t *font_opts)
double surface_w = logical_w, surface_h = logical_h;
double surface_shift_x = 0, surface_shift_y = 0;
bool include_logical = logical || !ink;
bool include_ink = ink || !logical;
bool include_logical = include_logical_extents ();
bool include_ink = include_ink_extents ();
if (include_ink)
{
cairo_surface_t *ink_surface = cairo_recording_surface_create (content, nullptr);
+2
View File
@@ -50,6 +50,8 @@ struct view_options_t
}
void add_options (option_parser_t *parser);
bool include_logical_extents () const { return logical || !ink; }
bool include_ink_extents () const { return ink || !logical; }
void post_parse (GError **error G_GNUC_UNUSED)
{
stroke_enabled = false;