pub struct TextRunTemplate {
pub common: PrimTemplateCommonData,
pub font: FontInstance,
pub glyphs: Vec<GlyphInstance>,
pub shadow: bool,
pub requested_raster_space: RasterSpace,
}Fields§
§common: PrimTemplateCommonData§font: FontInstance§glyphs: Vec<GlyphInstance>Glyph pen positions, each relative to the normalized prim rect origin.
See TextRunKey::glyphs. At frame time the normalized local glyph
position is prim_rect.min + glyph.point; request_resources then
transforms and device-snaps each glyph to produce the device-space
offsets handed to the shader.
shadow: bool§requested_raster_space: RasterSpaceImplementations§
Source§impl TextRunTemplate
impl TextRunTemplate
Sourcefn write_prim_gpu_blocks(
&self,
glyph_offsets: &[DeviceVector2D],
gpu_buffer: &mut GpuBufferBuilderImpl<GpuBufferBlockF>,
) -> GpuBufferAddress
fn write_prim_gpu_blocks( &self, glyph_offsets: &[DeviceVector2D], gpu_buffer: &mut GpuBufferBuilderImpl<GpuBufferBlockF>, ) -> GpuBufferAddress
Write the per-instance GPU blocks for this run: the premultiplied
font color followed by the per-glyph offsets (two glyphs packed per
block). The offsets are device-space in device mode and raster-space in
local-raster mode (see request_resources). Corresponds to
fetch_glyph / fetch_text_run in the shader.
Source§impl TextRunTemplate
impl TextRunTemplate
Sourcefn compute_font_instance(
specified_font: &FontInstance,
surface: &SurfaceInfo,
transform: &LayoutToWorldTransform,
allow_subpixel: bool,
raster_space: RasterSpace,
) -> (FontInstance, f32)
fn compute_font_instance( specified_font: &FontInstance, surface: &SurfaceInfo, transform: &LayoutToWorldTransform, allow_subpixel: bool, raster_space: RasterSpace, ) -> (FontInstance, f32)
Build a per-frame (used_font, raster_scale) pair for this text run.
The result is fresh per frame; nothing persists on the template.
Sourcefn get_raster_space_for_prim(
&self,
prim_spatial_node_index: SpatialNodeIndex,
low_quality_pinch_zoom: bool,
device_pixel_scale: DevicePixelScale,
spatial_tree: &SpatialTree,
) -> RasterSpace
fn get_raster_space_for_prim( &self, prim_spatial_node_index: SpatialNodeIndex, low_quality_pinch_zoom: bool, device_pixel_scale: DevicePixelScale, spatial_tree: &SpatialTree, ) -> RasterSpace
Gets the raster space to use when rendering this primitive. Usually this would be the requested raster space. However, if the primitive’s spatial node or one of its ancestors is being pinch zoomed then we round it. This prevents us rasterizing glyphs for every minor change in zoom level, as that would be too expensive.
pub fn request_resources( &self, local_rect: LayoutRect, transform: &LayoutToWorldTransform, surface: &SurfaceInfo, spatial_node_index: SpatialNodeIndex, allow_subpixel: bool, low_quality_pinch_zoom: bool, resource_cache: &mut ResourceCache, gpu_buffer: &mut GpuBufferBuilderImpl<GpuBufferBlockF>, spatial_tree: &SpatialTree, scratch: &mut PrimitiveScratchBuffer, ) -> Index<TextRunScratch>
Trait Implementations§
Source§impl DerefMut for TextRunTemplate
impl DerefMut for TextRunTemplate
Source§impl From<TextRunKey> for TextRunTemplate
impl From<TextRunKey> for TextRunTemplate
Source§fn from(item: TextRunKey) -> Self
fn from(item: TextRunKey) -> Self
Source§impl MallocSizeOf for TextRunTemplate
impl MallocSizeOf for TextRunTemplate
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl Serialize for TextRunTemplate
impl Serialize for TextRunTemplate
Auto Trait Implementations§
impl Freeze for TextRunTemplate
impl RefUnwindSafe for TextRunTemplate
impl Send for TextRunTemplate
impl Sync for TextRunTemplate
impl Unpin for TextRunTemplate
impl UnsafeUnpin for TextRunTemplate
impl UnwindSafe for TextRunTemplate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more