use geometry::Point;
use glam::Vec2;
use mln_map_types::{ProjectedTilePoint, TileProjector, TransformState};
use mln_text::glyph::WritingModeType;
use mln_tile_id::geometry_tile_data::GeometryCoordinate;
use mln_util::constants::ONE_EM;
use mln_util::mat4::{Mat4, matrix};
use mln_util::vectors::Vec4;
use crate::buckets::symbol_bucket::{
PlacedSymbol, PlacedSymbolPools, SymbolBucket, SymbolDynamicLayoutVertex, SymbolSizeBinder, ZoomEvaluatedSize,
};
use crate::render_tile::RenderTile;
pub(crate) fn get_tile_skew_vectors(state: &TransformState) -> ([f64; 2], [f64; 2]) {
let cos_roll = state.get_roll().cos();
let sin_roll = state.get_roll().sin();
let cos_pitch = state.get_pitch().cos();
let cos_bearing = (-state.get_bearing()).cos();
let sin_bearing = (-state.get_bearing()).sin();
let mut vec_south = [
-cos_bearing * cos_pitch * sin_roll - sin_bearing * cos_roll,
-sin_bearing * cos_pitch * sin_roll + cos_bearing * cos_roll,
];
let vec_south_len = vec_south[0].hypot(vec_south[1]);
if vec_south_len < 1.0e-9 {
vec_south = [0.0, 0.0];
} else {
vec_south[0] /= vec_south_len;
vec_south[1] /= vec_south_len;
}
let mut vec_east = [
cos_bearing * cos_pitch * cos_roll - sin_bearing * sin_roll,
sin_bearing * cos_pitch * cos_roll + cos_bearing * sin_roll,
];
let vec_east_len = vec_east[0].hypot(vec_east[1]);
if vec_east_len < 1.0e-9 {
vec_east = [0.0, 0.0];
} else {
vec_east[0] /= vec_east_len;
vec_east[1] /= vec_east_len;
}
(vec_east, vec_south)
}
pub(crate) fn get_tile_skew_matrix(state: &TransformState) -> Mat4 {
let (vec_east, vec_south) = get_tile_skew_vectors(state);
let mut m: Mat4 = [0.0; 16];
matrix::identity(&mut m);
m[0] = vec_east[0];
m[1] = vec_east[1];
m[4] = vec_south[0];
m[5] = vec_south[1];
m
}
pub(crate) fn get_label_plane_matrix(
pitch_with_map: bool,
rotate_with_map: bool,
state: &TransformState,
pixels_to_tile_units: f32,
) -> Mat4 {
let mut m: Mat4 = [0.0; 16];
matrix::identity(&mut m);
if pitch_with_map {
let s = f64::from(1.0 / pixels_to_tile_units);
let a = m;
matrix::scale(&mut m, &a, s, s, 1.0);
if !rotate_with_map {
let skew = get_tile_skew_matrix(state);
let mut inverted = skew;
matrix::invert(&mut inverted, &skew);
let a = m;
matrix::multiply(&mut m, &a, &inverted);
}
} else {
let size = state.get_size();
let a = m;
matrix::scale(&mut m, &a, f64::from(size.width) / 2.0, -(f64::from(size.height) / 2.0), 1.0);
let a = m;
matrix::translate(&mut m, &a, 1.0, -1.0, 0.0);
}
m
}
pub(crate) fn get_gl_coord_matrix(
pitch_with_map: bool,
rotate_with_map: bool,
state: &TransformState,
pixels_to_tile_units: f32,
) -> Mat4 {
let mut m: Mat4 = [0.0; 16];
matrix::identity(&mut m);
if pitch_with_map {
let s = f64::from(pixels_to_tile_units);
let a = m;
matrix::scale(&mut m, &a, s, s, 1.0);
if !rotate_with_map {
let a = m;
matrix::multiply(&mut m, &a, &get_tile_skew_matrix(state));
}
} else {
let size = state.get_size();
let a = m;
matrix::scale(&mut m, &a, 1.0, -1.0, 1.0);
let a = m;
matrix::translate(&mut m, &a, -1.0, -1.0, 0.0);
let a = m;
matrix::scale(&mut m, &a, 2.0 / f64::from(size.width), 2.0 / f64::from(size.height), 1.0);
}
m
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) struct TileDistance {
pub(crate) prev_tile_distance: f32,
pub(crate) last_segment_viewport_distance: f32,
}
impl TileDistance {
#[must_use]
pub(crate) fn new(prev_tile_distance: f32, last_segment_viewport_distance: f32) -> Self {
TileDistance { prev_tile_distance, last_segment_viewport_distance }
}
}
#[derive(Clone, Copy, Debug, PartialEq)]
pub(crate) struct PlacedGlyph {
pub(crate) point: Vec2,
pub(crate) angle: f32,
pub(crate) tile_distance: Option<TileDistance>,
}
impl PlacedGlyph {
#[must_use]
pub(crate) fn new(point: Vec2, angle: f32, tile_distance: Option<TileDistance>) -> Self {
PlacedGlyph { point, angle, tile_distance }
}
}
pub(crate) type PointAndCameraDistance = (Vec2, f32);
fn to_vec2(p: Point<i16>) -> Vec2 {
Vec2::new(f32::from(p.x), f32::from(p.y))
}
#[must_use]
pub(crate) fn project(point: Vec2, matrix: &Mat4) -> PointAndCameraDistance {
let mut pos: Vec4 = [f64::from(point.x), f64::from(point.y), 0.0, 1.0];
let a = pos;
matrix::transform_mat4(&mut pos, &a, matrix);
(Vec2::new((pos[0] / pos[3]) as f32, (pos[1] / pos[3]) as f32), pos[3] as f32)
}
#[must_use]
pub(crate) fn evaluate_size_for_feature(zoom_evaluated_size: &ZoomEvaluatedSize, placed_symbol: &PlacedSymbol) -> f32 {
if zoom_evaluated_size.is_feature_constant {
zoom_evaluated_size.size
} else if zoom_evaluated_size.is_zoom_constant {
placed_symbol.lower_size
} else {
placed_symbol.lower_size + zoom_evaluated_size.size_t * (placed_symbol.upper_size - placed_symbol.lower_size)
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
enum PlacementResult {
Ok,
NotEnoughRoom,
NeedsFlipping,
UseVertical,
}
#[derive(Clone)]
pub(crate) struct LabelPlaneProjector<'a> {
tile: TileProjector<'a>,
pitch_with_map: bool,
translation: Vec2,
pitched_label_plane_matrix: Mat4,
pitched_label_plane_matrix_inverse: Mat4,
width: f32,
height: f32,
elevation: f64,
}
impl<'a> LabelPlaneProjector<'a> {
#[must_use]
pub(crate) fn new(
tile: &TileProjector<'a>,
pitch_with_map: bool,
rotate_with_map: bool,
pixels_to_tile_units: f32,
translation: Vec2,
) -> Self {
let size = tile.get_transform_state().get_size();
let mut pitched_label_plane_matrix: Mat4 = [0.0; 16];
let mut pitched_label_plane_matrix_inverse: Mat4 = [0.0; 16];
if pitch_with_map {
pitched_label_plane_matrix =
get_label_plane_matrix(true, rotate_with_map, tile.get_transform_state(), pixels_to_tile_units);
matrix::invert(&mut pitched_label_plane_matrix_inverse, &pitched_label_plane_matrix);
} else {
matrix::identity(&mut pitched_label_plane_matrix);
matrix::identity(&mut pitched_label_plane_matrix_inverse);
}
LabelPlaneProjector {
tile: *tile,
pitch_with_map,
translation,
pitched_label_plane_matrix,
pitched_label_plane_matrix_inverse,
width: size.width as f32,
height: size.height as f32,
elevation: 0.0,
}
}
#[must_use]
pub(crate) fn raised(&self, height_offset: f32) -> Self {
LabelPlaneProjector { elevation: f64::from(height_offset), ..self.clone() }
}
#[must_use]
pub(crate) fn project(&self, tile_point: Vec2) -> ProjectedTilePoint {
let translated = tile_point + self.translation;
if self.pitch_with_map {
let projected = project(translated, &self.pitched_label_plane_matrix);
return ProjectedTilePoint {
point: Point::new(f64::from(projected.0.x), f64::from(projected.0.y)),
signed_distance_from_camera: f64::from(projected.1),
occluded: false,
};
}
let mut projected =
self.tile.project(&Point::new(f64::from(translated.x), f64::from(translated.y)), self.elevation);
projected.point = Point::new(
(projected.point.x * 0.5 + 0.5) * f64::from(self.width),
(-projected.point.y * 0.5 + 0.5) * f64::from(self.height),
);
projected
}
#[must_use]
pub(crate) fn to_clip_space(&self, label_plane_point: Vec2) -> Vec2 {
if self.pitch_with_map {
let tile_point = project(label_plane_point, &self.pitched_label_plane_matrix_inverse).0;
let projected =
self.tile.project(&Point::new(f64::from(tile_point.x), f64::from(tile_point.y)), self.elevation);
return Vec2::new(projected.point.x as f32, projected.point.y as f32);
}
Vec2::new((label_plane_point.x / self.width) * 2.0 - 1.0, 1.0 - (label_plane_point.y / self.height) * 2.0)
}
#[must_use]
pub(crate) fn to_clip_space_from_tile(&self, tile_point: Vec2) -> ProjectedTilePoint {
self.tile.project(&Point::new(f64::from(tile_point.x), f64::from(tile_point.y)), self.elevation)
}
}
#[derive(Debug, Default)]
pub(crate) struct LineProjectionCache {
points: Vec<Option<ProjectedTilePoint>>,
occluded: bool,
}
impl LineProjectionCache {
pub(crate) fn reset(&mut self, vertex_count: usize) {
self.points.clear();
self.points.resize(vertex_count, None);
self.occluded = false;
}
pub(crate) fn get(
&mut self,
index: usize,
line: &[GeometryCoordinate],
label_plane: &LabelPlaneProjector<'_>,
) -> ProjectedTilePoint {
if let Some(cached) = self.points[index] {
return cached;
}
let projected = label_plane.project(to_vec2(line[index]));
self.occluded |= projected.occluded;
self.points[index] = Some(projected);
projected
}
#[must_use]
pub(crate) fn any_occluded(&self) -> bool {
self.occluded
}
}
fn is_visible(anchor_pos: &Point<f64>, clipping_buffer: &[f64; 2]) -> bool {
let x = anchor_pos.x;
let y = anchor_pos.y;
x >= -clipping_buffer[0] && x <= clipping_buffer[0] && y >= -clipping_buffer[1] && y <= clipping_buffer[1]
}
pub(crate) fn add_dynamic_attributes(
anchor_point: Vec2,
angle: f32,
dynamic_attribute_data: &mut Vec<SymbolDynamicLayoutVertex>,
) {
let dynamic_attributes = SymbolBucket::dynamic_layout_attributes(anchor_point, angle);
dynamic_attribute_data.push(dynamic_attributes);
dynamic_attribute_data.push(dynamic_attributes);
dynamic_attribute_data.push(dynamic_attributes);
dynamic_attribute_data.push(dynamic_attributes);
}
pub(crate) fn hide_glyphs(num_glyphs: usize, dynamic_vertex_array: &mut Vec<SymbolDynamicLayoutVertex>) {
let count = 4;
let offscreen_point = Vec2::new(f32::NEG_INFINITY, f32::NEG_INFINITY);
if dynamic_vertex_array.is_empty() {
dynamic_vertex_array.reserve(count * num_glyphs);
}
for _ in 0..num_glyphs {
add_dynamic_attributes(offscreen_point, 0.0, dynamic_vertex_array);
}
}
fn project_truncated_line_segment(
previous_tile_point: Vec2,
current_tile_point: Vec2,
previous_projected_point: Vec2,
minimum_length: f32,
project_point: impl Fn(Vec2) -> Vec2,
) -> Vec2 {
let projected_unit_vertex =
project_point(previous_tile_point + (previous_tile_point - current_tile_point).normalize_or_zero());
let projected_unit_segment = previous_projected_point - projected_unit_vertex;
previous_projected_point + projected_unit_segment * (minimum_length / projected_unit_segment.length())
}
#[expect(
clippy::too_many_arguments,
reason = "the glyph's offsets, the anchor in both spaces, the line and its distances, and the projection and its cache"
)]
fn place_glyph_along_line(
offset_x: f32,
line_offset_x: f32,
line_offset_y: f32,
flip: bool,
projected_anchor_point: Vec2,
tile_anchor_point: Vec2,
anchor_segment: u16,
line: &[GeometryCoordinate],
tile_distances: &[f32],
label_plane: &LabelPlaneProjector<'_>,
projections: &mut LineProjectionCache,
return_tile_distance: bool,
) -> Option<PlacedGlyph> {
let combined_offset_x = if flip { offset_x - line_offset_x } else { offset_x + line_offset_x };
let mut dir: i16 = if combined_offset_x > 0.0 { 1 } else { -1 };
let mut angle: f32 = 0.0;
if flip {
dir *= -1;
angle = std::f32::consts::PI;
}
if dir < 0 {
angle += std::f32::consts::PI;
}
let mut current_index: i32 = if dir > 0 { i32::from(anchor_segment) } else { i32::from(anchor_segment) + 1 };
let initial_index = current_index;
let mut current = projected_anchor_point;
let mut prev = projected_anchor_point;
let mut distance_to_prev: f32 = 0.0;
let mut current_segment_distance: f32 = 0.0;
let abs_offset_x = combined_offset_x.abs();
while distance_to_prev + current_segment_distance <= abs_offset_x {
current_index += i32::from(dir);
if current_index < 0 || current_index >= line.len() as i32 {
return None;
}
prev = current;
let projection = projections.get(current_index as usize, line, label_plane);
if projection.signed_distance_from_camera > 0.0 {
current = Vec2::new(projection.point.x as f32, projection.point.y as f32);
} else {
let previous_tile_point = if distance_to_prev == 0.0 {
tile_anchor_point
} else {
to_vec2(line[(current_index - i32::from(dir)) as usize])
};
let current_tile_point = to_vec2(line[current_index as usize]);
current = project_truncated_line_segment(
previous_tile_point,
current_tile_point,
prev,
abs_offset_x - distance_to_prev + 1.0,
|p| {
let projected = label_plane.project(p);
Vec2::new(projected.point.x as f32, projected.point.y as f32)
},
);
}
distance_to_prev += current_segment_distance;
current_segment_distance = prev.distance(current);
}
let segment_interpolation_t = (abs_offset_x - distance_to_prev) / current_segment_distance;
let prev_to_current = current - prev;
let mut p = prev_to_current * segment_interpolation_t + prev;
let mag = f64::from(prev_to_current.length());
p += prev_to_current.perp() * ((f64::from(line_offset_y * f32::from(dir)) / mag) as f32);
let segment_angle = angle + (current.y - prev.y).atan2(current.x - prev.x);
Some(PlacedGlyph::new(
p,
segment_angle,
if return_tile_distance {
Some(TileDistance::new(
if (current_index - i32::from(dir)) == initial_index {
0.0
} else {
tile_distances[(current_index - i32::from(dir)) as usize]
},
abs_offset_x - distance_to_prev,
))
} else {
None
},
))
}
#[expect(
clippy::too_many_arguments,
reason = "the label's offsets, the anchor in both spaces, the symbol, and the projection and its cache"
)]
pub(crate) fn place_first_and_last_glyph(
font_scale: f32,
line_offset_x: f32,
line_offset_y: f32,
flip: bool,
anchor_point: Vec2,
tile_anchor_point: Vec2,
symbol: &PlacedSymbol,
pools: &PlacedSymbolPools,
label_plane: &LabelPlaneProjector<'_>,
projections: &mut LineProjectionCache,
return_tile_distance: bool,
) -> Option<(PlacedGlyph, PlacedGlyph)> {
let glyph_offsets = pools.glyph_offsets(symbol);
let (Some(&first_glyph_offset), Some(&last_glyph_offset)) = (glyph_offsets.first(), glyph_offsets.last()) else {
debug_assert!(false);
return None;
};
let first_placed_glyph = place_glyph_along_line(
font_scale * first_glyph_offset,
line_offset_x,
line_offset_y,
flip,
anchor_point,
tile_anchor_point,
symbol.segment as u16,
pools.line(symbol),
pools.tile_distances(symbol),
label_plane,
projections,
return_tile_distance,
)?;
let last_placed_glyph = place_glyph_along_line(
font_scale * last_glyph_offset,
line_offset_x,
line_offset_y,
flip,
anchor_point,
tile_anchor_point,
symbol.segment as u16,
pools.line(symbol),
pools.tile_distances(symbol),
label_plane,
projections,
return_tile_distance,
)?;
if projections.any_occluded() {
return None;
}
Some((first_placed_glyph, last_placed_glyph))
}
fn requires_orientation_change(
writing_modes: WritingModeType,
first_point: Vec2,
last_point: Vec2,
aspect_ratio: f32,
) -> Option<PlacementResult> {
if writing_modes == (WritingModeType::Horizontal | WritingModeType::Vertical) {
let rise = (last_point.y - first_point.y).abs();
let run = (last_point.x - first_point.x).abs() * aspect_ratio;
if rise > run {
return Some(PlacementResult::UseVertical);
}
}
if if writing_modes == WritingModeType::Vertical {
first_point.y < last_point.y
} else {
first_point.x > last_point.x
} {
return Some(PlacementResult::NeedsFlipping);
}
None
}
#[expect(
clippy::too_many_arguments,
reason = "the symbol, its size and orientation flags, the projection and its cache, and the vertices it writes"
)]
fn place_glyphs_along_line(
symbol: &PlacedSymbol,
pools: &PlacedSymbolPools,
font_size: f32,
flip: bool,
keep_upright: bool,
rotate_to_line: bool,
label_plane: &LabelPlaneProjector<'_>,
projections: &mut LineProjectionCache,
dynamic_vertex_array: &mut Vec<SymbolDynamicLayoutVertex>,
projected_anchor_point: Vec2,
aspect_ratio: f32,
) -> PlacementResult {
let font_scale = font_size / ONE_EM;
let line_offset_x = symbol.line_offset[0] * font_scale;
let line_offset_y = symbol.line_offset[1] * font_scale;
let line = pools.line(symbol);
let tile_distances = pools.tile_distances(symbol);
let glyph_offsets = pools.glyph_offsets(symbol);
let mut placed_glyphs: Vec<PlacedGlyph> = Vec::new();
if glyph_offsets.len() > 1 {
let Some(first_and_last_glyph) = place_first_and_last_glyph(
font_scale,
line_offset_x,
line_offset_y,
flip,
projected_anchor_point,
symbol.anchor_point,
symbol,
pools,
label_plane,
projections,
false,
) else {
return PlacementResult::NotEnoughRoom;
};
let first_point = label_plane.to_clip_space(first_and_last_glyph.0.point);
let last_point = label_plane.to_clip_space(first_and_last_glyph.1.point);
if keep_upright
&& !flip
&& let Some(orientation_change) =
requires_orientation_change(symbol.writing_modes, first_point, last_point, aspect_ratio)
{
return orientation_change;
}
placed_glyphs.reserve(glyph_offsets.len());
placed_glyphs.push(first_and_last_glyph.0);
for &glyph_offset_x in &glyph_offsets[1..glyph_offsets.len() - 1] {
let placed_glyph = place_glyph_along_line(
glyph_offset_x * font_scale,
line_offset_x,
line_offset_y,
flip,
projected_anchor_point,
symbol.anchor_point,
symbol.segment as u16,
line,
tile_distances,
label_plane,
projections,
false,
);
match placed_glyph {
Some(placed_glyph) => placed_glyphs.push(placed_glyph),
None => {
placed_glyphs.push(PlacedGlyph::new(Vec2::new(f32::NEG_INFINITY, f32::NEG_INFINITY), 0.0, None));
}
}
}
placed_glyphs.push(first_and_last_glyph.1);
} else if glyph_offsets.len() == 1 {
if keep_upright && !flip {
let to_clip = |p: Vec2| {
let projected = label_plane.to_clip_space_from_tile(p);
Vec2::new(projected.point.x as f32, projected.point.y as f32)
};
let a = to_clip(symbol.anchor_point);
let tile_segment_end = to_vec2(line[symbol.segment + 1]);
let projected_vertex = label_plane.to_clip_space_from_tile(tile_segment_end);
let b = if projected_vertex.signed_distance_from_camera > 0.0 {
Vec2::new(projected_vertex.point.x as f32, projected_vertex.point.y as f32)
} else {
project_truncated_line_segment(symbol.anchor_point, tile_segment_end, a, 1.0, to_clip)
};
if let Some(orientation_change) = requires_orientation_change(symbol.writing_modes, a, b, aspect_ratio) {
return orientation_change;
}
}
let glyph_offset_x = glyph_offsets[0];
let single_glyph = place_glyph_along_line(
font_scale * glyph_offset_x,
line_offset_x,
line_offset_y,
flip,
projected_anchor_point,
symbol.anchor_point,
symbol.segment as u16,
line,
tile_distances,
label_plane,
projections,
false,
);
let Some(single_glyph) = single_glyph.filter(|_| !projections.any_occluded()) else {
return PlacementResult::NotEnoughRoom;
};
placed_glyphs.push(single_glyph);
}
if dynamic_vertex_array.is_empty() {
dynamic_vertex_array.reserve(4 * placed_glyphs.len());
}
for placed_glyph in &placed_glyphs {
let angle = if rotate_to_line { placed_glyph.angle } else { 0.0 };
add_dynamic_attributes(placed_glyph.point, angle, dynamic_vertex_array);
}
PlacementResult::Ok
}
#[expect(
clippy::too_many_arguments,
reason = "the tile's symbols, projector and size binder, the alignment flags and the vertices it writes"
)]
pub(crate) fn reproject_line_labels(
dynamic_vertex_array: &mut Vec<SymbolDynamicLayoutVertex>,
placed_symbols: &[PlacedSymbol],
pools: &PlacedSymbolPools,
tile_projector: &TileProjector<'_>,
pitch_with_map: bool,
rotate_with_map: bool,
keep_upright: bool,
tile: &RenderTile,
size_binder: &SymbolSizeBinder,
state: &TransformState,
translation: Vec2,
) {
let partially_evaluated_size = size_binder.evaluate_for_zoom(state.get_zoom() as f32);
let size = state.get_size();
let clipping_buffer: [f64; 2] =
[256.0 / f64::from(size.width) * 2.0 + 1.0, 256.0 / f64::from(size.height) * 2.0 + 1.0];
let pixels_to_tile_units = tile.id.pixels_to_tile_units(1.0, state.get_zoom() as f32);
let label_plane =
LabelPlaneProjector::new(tile_projector, pitch_with_map, rotate_with_map, pixels_to_tile_units, translation);
dynamic_vertex_array.clear();
let mut use_vertical = false;
let mut projections = LineProjectionCache::default();
for placed_symbol in placed_symbols {
if placed_symbol.hidden || (placed_symbol.writing_modes == WritingModeType::Vertical && !use_vertical) {
hide_glyphs(placed_symbol.glyph_offsets.len(), dynamic_vertex_array);
continue;
}
use_vertical = false;
let tile_anchor = Point::new(f64::from(placed_symbol.anchor_point.x), f64::from(placed_symbol.anchor_point.y));
let anchor_pos = tile_projector.project(&tile_anchor, 0.0);
if anchor_pos.occluded || !is_visible(&anchor_pos.point, &clipping_buffer) {
hide_glyphs(placed_symbol.glyph_offsets.len(), dynamic_vertex_array);
continue;
}
let camera_to_anchor_distance = anchor_pos.signed_distance_from_camera as f32;
let perspective_ratio = 0.5 + 0.5 * (camera_to_anchor_distance / state.get_camera_to_center_distance());
let font_size = evaluate_size_for_feature(&partially_evaluated_size, placed_symbol);
let pitch_scaled_font_size = if pitch_with_map {
font_size * perspective_ratio * tile_projector.pitched_text_correction(&tile_anchor) as f32
} else {
font_size / perspective_ratio
};
let projected_anchor = label_plane.project(placed_symbol.anchor_point).point;
let anchor_point = Vec2::new(projected_anchor.x as f32, projected_anchor.y as f32);
projections.reset(placed_symbol.line.len());
let place_unflipped = place_glyphs_along_line(
placed_symbol,
pools,
pitch_scaled_font_size,
false,
keep_upright,
rotate_with_map,
&label_plane,
&mut projections,
dynamic_vertex_array,
anchor_point,
size.aspect_ratio(),
);
use_vertical = place_unflipped == PlacementResult::UseVertical;
if place_unflipped == PlacementResult::NotEnoughRoom
|| use_vertical
|| (place_unflipped == PlacementResult::NeedsFlipping
&& place_glyphs_along_line(
placed_symbol,
pools,
pitch_scaled_font_size,
true,
keep_upright,
rotate_with_map,
&label_plane,
&mut projections,
dynamic_vertex_array,
anchor_point,
size.aspect_ratio(),
) == PlacementResult::NotEnoughRoom)
{
hide_glyphs(placed_symbol.glyph_offsets.len(), dynamic_vertex_array);
}
}
}