style: apply nightly rustfmt import grouping across the workspace
rustfmt.toml sets group_imports, imports_granularity and imports_layout, which are nightly-only; agents formatted with stable rustfmt, which ignored them. This is a formatting-only pass with `cargo +nightly fmt`. Test Plan: - cargo clippy --workspace --all-targets -- -D warnings - cargo test --workspace
This commit is contained in:
1 parent
3fd4ea6ae9
commit
126da77a37
259 files changed
+2495
-1547
No files matched your search
@@ -14,8 +14,10 @@
|
||||
//! that regions written INTO the atlas do not have to be square, only
|
||||
//! the full atlas texture itself.
|
||||
|
||||
use std::io::Write;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::{
|
||||
io::Write,
|
||||
sync::atomic::{AtomicUsize, Ordering},
|
||||
};
|
||||
|
||||
/// The format of the texture data being written into the Atlas. This must be
|
||||
/// uniform for all textures in the Atlas. If you have some textures with
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
//! The canonical definition lives in `ghostty-config` (the `font-codepoint-map`
|
||||
//! option parses straight into it); it is re-exported here.
|
||||
|
||||
pub use ghostty_config::font_types::CodepointMap;
|
||||
pub use ghostty_config::font_types::CodepointMapEntry as Entry;
|
||||
pub use ghostty_config::font_types::{CodepointMap, CodepointMapEntry as Entry};
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use ghostty_config::font_types::Descriptor;
|
||||
|
||||
use super::*;
|
||||
|
||||
fn desc(family: &str) -> Descriptor {
|
||||
Descriptor {
|
||||
family: Some(family.to_string()),
|
||||
|
||||
@@ -10,13 +10,18 @@
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::collection::{
|
||||
AddOptions, Collection, Entry, GetFaceError, Index, PresentationMode, Special,
|
||||
use crate::{
|
||||
Atlas,
|
||||
CodepointMap,
|
||||
Glyph,
|
||||
Presentation,
|
||||
SpriteFace,
|
||||
Style,
|
||||
collection::{AddOptions, Collection, Entry, GetFaceError, Index, PresentationMode, Special},
|
||||
discovery::Discover,
|
||||
face::{RenderOptions, freetype::RenderError as FaceRenderError},
|
||||
sprite,
|
||||
};
|
||||
use crate::discovery::Discover;
|
||||
use crate::face::{RenderOptions, freetype::RenderError as FaceRenderError};
|
||||
use crate::sprite;
|
||||
use crate::{Atlas, CodepointMap, Glyph, Presentation, SpriteFace, Style};
|
||||
|
||||
/// Packed array of booleans to indicate if a style is enabled or not.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
@@ -449,9 +454,13 @@ impl CodepointResolver {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::collection::{LoadOptions, SizeAdjustment};
|
||||
use crate::face::{DesiredSize, Options};
|
||||
use crate::{Face, Library, embedded};
|
||||
use crate::{
|
||||
Face,
|
||||
Library,
|
||||
collection::{LoadOptions, SizeAdjustment},
|
||||
embedded,
|
||||
face::{DesiredSize, Options},
|
||||
};
|
||||
|
||||
fn add(c: &mut Collection, lib: &Library, data: &'static [u8], style: Style, pts: f32) {
|
||||
let size = if pts == 12.0 {
|
||||
|
||||
@@ -16,10 +16,17 @@
|
||||
|
||||
#![allow(clippy::collapsible_if, clippy::if_not_else, clippy::float_cmp)]
|
||||
|
||||
use crate::config_types::{FontSyntheticStyle, FreetypeLoadFlags};
|
||||
use crate::face::{self, DesiredSize};
|
||||
use crate::metrics::{FaceMetrics, ModifierSet};
|
||||
use crate::{DeferredFace, Face, Library, Metrics, Presentation, Style};
|
||||
use crate::{
|
||||
DeferredFace,
|
||||
Face,
|
||||
Library,
|
||||
Metrics,
|
||||
Presentation,
|
||||
Style,
|
||||
config_types::{FontSyntheticStyle, FreetypeLoadFlags},
|
||||
face::{self, DesiredSize},
|
||||
metrics::{FaceMetrics, ModifierSet},
|
||||
};
|
||||
|
||||
/// The available faces we have. This shouldn't be modified manually.
|
||||
/// Instead, use the functions available on Collection.
|
||||
@@ -1016,8 +1023,10 @@ impl Index {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::face::{DesiredSize, Options};
|
||||
use crate::{
|
||||
embedded,
|
||||
face::{DesiredSize, Options},
|
||||
};
|
||||
|
||||
fn opts_96(points: f32) -> Options {
|
||||
Options::new(DesiredSize {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
//! The config types consumed by the font engine. The canonical definitions
|
||||
//! live in `ghostty-config`; they are re-exported here for convenience.
|
||||
|
||||
pub use ghostty_config::types_a::{FontShapingBreak, FontStyle, FontSyntheticStyle};
|
||||
pub use ghostty_config::types_b::{FreetypeLoadFlags, GraphemeWidthMethod};
|
||||
pub use ghostty_config::{
|
||||
types_a::{FontShapingBreak, FontStyle, FontSyntheticStyle},
|
||||
types_b::{FreetypeLoadFlags, GraphemeWidthMethod},
|
||||
};
|
||||
@@ -7,9 +7,13 @@
|
||||
//!
|
||||
//! Port of `font/DeferredFace.zig` (fontconfig variant only).
|
||||
|
||||
use crate::face::{self, Options, Variation};
|
||||
use crate::fontconfig as fc;
|
||||
use crate::{Face, Library, Presentation};
|
||||
use crate::{
|
||||
Face,
|
||||
Library,
|
||||
Presentation,
|
||||
face::{self, Options, Variation},
|
||||
fontconfig as fc,
|
||||
};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum LoadError {
|
||||
|
||||
@@ -3,10 +3,12 @@
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::collection::Collection;
|
||||
use crate::deferred_face::{DeferredFace, Fontconfig as DeferredFontconfig};
|
||||
use crate::face::Variation;
|
||||
use crate::fontconfig as fc;
|
||||
use crate::{
|
||||
collection::Collection,
|
||||
deferred_face::{DeferredFace, Fontconfig as DeferredFontconfig},
|
||||
face::Variation,
|
||||
fontconfig as fc,
|
||||
};
|
||||
|
||||
/// Discover implementation for the compile options.
|
||||
pub type Discover = Fontconfig;
|
||||
|
||||
@@ -6,14 +6,18 @@
|
||||
//!
|
||||
//! Port of `font/face/freetype.zig`.
|
||||
|
||||
use std::ffi::CString;
|
||||
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
|
||||
use std::{
|
||||
ffi::CString,
|
||||
sync::{Arc, Mutex, MutexGuard, PoisonError},
|
||||
};
|
||||
|
||||
use super::{DesiredSize, FontData, FreetypeLoadFlags, Options, RenderOptions, Variation};
|
||||
use crate::atlas::{self, Atlas};
|
||||
use crate::glyph::Glyph;
|
||||
use crate::library::Library;
|
||||
use crate::metrics::FaceMetrics;
|
||||
use crate::{
|
||||
atlas::{self, Atlas},
|
||||
glyph::Glyph,
|
||||
library::Library,
|
||||
metrics::FaceMetrics,
|
||||
};
|
||||
|
||||
pub(crate) mod ft;
|
||||
mod resize;
|
||||
|
||||
@@ -8,8 +8,10 @@
|
||||
// c_long is i64 on Linux but not everywhere; keep the casts portable.
|
||||
#![allow(clippy::unnecessary_cast)]
|
||||
|
||||
use std::ffi::{CStr, c_int, c_long, c_uint, c_ulong, c_void};
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::{
|
||||
ffi::{CStr, c_int, c_long, c_uint, c_ulong, c_void},
|
||||
ptr::{self, NonNull},
|
||||
};
|
||||
|
||||
use freetype_sys as sys;
|
||||
|
||||
|
||||
@@ -4,9 +4,11 @@
|
||||
//! All raw FFI is confined to this module.
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
use std::ffi::{CStr, CString, c_int};
|
||||
use std::ptr::{self, NonNull};
|
||||
use std::sync::Arc;
|
||||
use std::{
|
||||
ffi::{CStr, CString, c_int},
|
||||
ptr::{self, NonNull},
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use fontconfig_sys as sys;
|
||||
use fontconfig_sys::constants as fc;
|
||||
|
||||
@@ -29,7 +29,6 @@ pub mod sprite;
|
||||
|
||||
pub use atlas::Atlas;
|
||||
pub use backend::{Backend, OPTIONS as options};
|
||||
|
||||
pub use codepoint_map::CodepointMap;
|
||||
pub use codepoint_resolver::CodepointResolver;
|
||||
pub use collection::Collection;
|
||||
@@ -39,7 +38,6 @@ pub use face::Face;
|
||||
pub use glyph::Glyph;
|
||||
pub use library::Library;
|
||||
pub use metrics::Metrics;
|
||||
|
||||
pub use shared_grid::SharedGrid;
|
||||
pub use shared_grid_set::SharedGridSet;
|
||||
pub use sprite::{Face as SpriteFace, Sprite};
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
//! Font metrics for the terminal grid. Port of `font/Metrics.zig`.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::str::FromStr;
|
||||
use std::{collections::HashMap, str::FromStr};
|
||||
|
||||
/// Metrics describing the terminal grid cell for a font.
|
||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
//! Field names are in camelCase to match names in the spec.
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use super::sfnt::Fixed;
|
||||
use super::{EndOfStream, Reader};
|
||||
use super::{EndOfStream, Reader, sfnt::Fixed};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Head {
|
||||
@@ -81,8 +80,7 @@ impl Head {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::opentype::sfnt::Sfnt;
|
||||
use crate::{embedded, opentype::sfnt::Sfnt};
|
||||
|
||||
#[test]
|
||||
fn head() {
|
||||
|
||||
@@ -70,8 +70,7 @@ impl Hhea {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::opentype::sfnt::Sfnt;
|
||||
use crate::{embedded, opentype::sfnt::Sfnt};
|
||||
|
||||
#[test]
|
||||
fn hhea() {
|
||||
|
||||
@@ -212,8 +212,7 @@ impl OS2 {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::opentype::sfnt::Sfnt;
|
||||
use crate::{embedded, opentype::sfnt::Sfnt};
|
||||
|
||||
#[test]
|
||||
fn os_2() {
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
//! - https://learn.microsoft.com/en-us/typography/opentype/spec/post
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use super::sfnt::{Fixed, Version16Dot16};
|
||||
use super::{EndOfStream, Reader};
|
||||
use super::{
|
||||
EndOfStream,
|
||||
Reader,
|
||||
sfnt::{Fixed, Version16Dot16},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct Post {
|
||||
@@ -44,8 +47,7 @@ impl Post {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::opentype::sfnt::Sfnt;
|
||||
use crate::{embedded, opentype::sfnt::Sfnt};
|
||||
|
||||
#[test]
|
||||
fn post() {
|
||||
|
||||
@@ -119,8 +119,7 @@ impl<'a> SVG<'a> {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::embedded;
|
||||
use crate::opentype::sfnt::Sfnt;
|
||||
use crate::{embedded, opentype::sfnt::Sfnt};
|
||||
|
||||
// NOTE: the Zig test obtains the table through `Face.copyTable`; we read
|
||||
// the same bytes through the SFNT directory (Face-based variant lives
|
||||
|
||||
@@ -3,14 +3,16 @@
|
||||
//! The shaper implementation for the Linux backend is HarfBuzz
|
||||
//! ([`crate::shaper::harfbuzz::Shaper`]).
|
||||
|
||||
pub use crate::shaper::cache::Cache;
|
||||
pub use crate::shaper::feature::{DEFAULT_FEATURES, Feature, FeatureList};
|
||||
pub use crate::shaper::run::{RunIterator, RunIteratorHook, RunOptions, TextRun};
|
||||
pub use crate::shaper::{harfbuzz, noop};
|
||||
|
||||
/// Shaper implementation for our compile options (backend
|
||||
/// `fontconfig_freetype` => HarfBuzz).
|
||||
pub use crate::shaper::harfbuzz::Shaper;
|
||||
pub use crate::shaper::{
|
||||
cache::Cache,
|
||||
feature::{DEFAULT_FEATURES, Feature, FeatureList},
|
||||
harfbuzz,
|
||||
noop,
|
||||
run::{RunIterator, RunIteratorHook, RunOptions, TextRun},
|
||||
};
|
||||
|
||||
/// A cell is a single single within a terminal that should be rendered
|
||||
/// for a shaping call. Note all terminal cells may be present; only
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
//! prepare/add/finalize/shape sequence.
|
||||
|
||||
use super::hb;
|
||||
use crate::face::freetype::Face;
|
||||
use crate::shape::{self, Cell, DEFAULT_FEATURES, FeatureList, TextRun};
|
||||
use crate::shared_grid::SharedGrid;
|
||||
use crate::{
|
||||
face::freetype::Face,
|
||||
shape::{self, Cell, DEFAULT_FEATURES, FeatureList, TextRun},
|
||||
shared_grid::SharedGrid,
|
||||
};
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum ShapeError {
|
||||
@@ -297,13 +299,22 @@ impl Shaper {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::face::{DesiredSize, FontData, Options};
|
||||
use crate::shaper::run::{RunIterator, RunOptions};
|
||||
use crate::shaper::test_util::{
|
||||
Term, TestFont, shape_all, test_shaper, test_shaper_with_discovered_font,
|
||||
test_shaper_with_font,
|
||||
use crate::{
|
||||
Library,
|
||||
embedded,
|
||||
face::{DesiredSize, FontData, Options},
|
||||
shaper::{
|
||||
run::{RunIterator, RunOptions},
|
||||
test_util::{
|
||||
Term,
|
||||
TestFont,
|
||||
shape_all,
|
||||
test_shaper,
|
||||
test_shaper_with_discovered_font,
|
||||
test_shaper_with_font,
|
||||
},
|
||||
},
|
||||
};
|
||||
use crate::{Library, embedded};
|
||||
|
||||
fn text(s: &str) -> Vec<(u32, u32)> {
|
||||
s.chars()
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
//! Each individual codepoint is mapped directly to the detected text run
|
||||
//! font's glyph index.
|
||||
|
||||
use crate::face::freetype::Face;
|
||||
use crate::shape::{self, Cell};
|
||||
use crate::{
|
||||
face::freetype::Face,
|
||||
shape::{self, Cell},
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
struct Codepoint {
|
||||
|
||||
@@ -12,12 +12,17 @@
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
|
||||
use ghostty_config::types_a::FontShapingBreak;
|
||||
use ghostty_terminal::page::{Cell, ContentTag, Page, Wide};
|
||||
use ghostty_terminal::style::{Color, Style as TermStyle};
|
||||
use ghostty_terminal::{
|
||||
page::{Cell, ContentTag, Page, Wide},
|
||||
style::{Color, Style as TermStyle},
|
||||
};
|
||||
|
||||
use crate::collection::Index;
|
||||
use crate::shared_grid::{Error as GridError, SharedGrid};
|
||||
use crate::{Presentation, Style};
|
||||
use crate::{
|
||||
Presentation,
|
||||
Style,
|
||||
collection::Index,
|
||||
shared_grid::{Error as GridError, SharedGrid},
|
||||
};
|
||||
|
||||
/// The Kitty graphics unicode placeholder codepoint
|
||||
/// (`terminal.kitty.graphics.unicode.placeholder`).
|
||||
|
||||
@@ -9,19 +9,29 @@
|
||||
|
||||
#![allow(clippy::collapsible_if)]
|
||||
|
||||
use ghostty_terminal::page::Cell;
|
||||
use ghostty_terminal::point::{Coordinate, Point};
|
||||
use ghostty_terminal::screen::{Options, Screen};
|
||||
use ghostty_vt::color::Rgb;
|
||||
use ghostty_vt::sgr::Attribute;
|
||||
use ghostty_terminal::{
|
||||
page::Cell,
|
||||
point::{Coordinate, Point},
|
||||
screen::{Options, Screen},
|
||||
};
|
||||
use ghostty_vt::{color::Rgb, sgr::Attribute};
|
||||
|
||||
use crate::codepoint_resolver::CodepointResolver;
|
||||
use crate::collection::{AddOptions, Collection, LoadOptions, SizeAdjustment};
|
||||
use crate::discovery::{Descriptor, Fontconfig};
|
||||
use crate::face::{DesiredSize, FontData, Options as FaceOptions};
|
||||
use crate::shaper::harfbuzz::Shaper;
|
||||
use crate::shaper::run::{RunCell, RunIterator, RunOptions};
|
||||
use crate::{Face, Library, SharedGrid, Style, embedded, shape};
|
||||
use crate::{
|
||||
Face,
|
||||
Library,
|
||||
SharedGrid,
|
||||
Style,
|
||||
codepoint_resolver::CodepointResolver,
|
||||
collection::{AddOptions, Collection, LoadOptions, SizeAdjustment},
|
||||
discovery::{Descriptor, Fontconfig},
|
||||
embedded,
|
||||
face::{DesiredSize, FontData, Options as FaceOptions},
|
||||
shape,
|
||||
shaper::{
|
||||
harfbuzz::Shaper,
|
||||
run::{RunCell, RunIterator, RunOptions},
|
||||
},
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) enum TestFont {
|
||||
|
||||
@@ -19,14 +19,22 @@
|
||||
|
||||
#![allow(clippy::collapsible_if, clippy::if_not_else, clippy::float_cmp)]
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard};
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
sync::{RwLock, RwLockReadGuard, RwLockWriteGuard},
|
||||
};
|
||||
|
||||
use crate::atlas::{self, Atlas};
|
||||
use crate::codepoint_resolver::{CodepointResolver, RenderGlyphError};
|
||||
use crate::collection::{self, Collection, GetFaceError, Index, PresentationMode};
|
||||
use crate::face::{Constraint, ConstraintSize, RenderOptions};
|
||||
use crate::{Glyph, Metrics, Presentation, SpriteFace, Style};
|
||||
use crate::{
|
||||
Glyph,
|
||||
Metrics,
|
||||
Presentation,
|
||||
SpriteFace,
|
||||
Style,
|
||||
atlas::{self, Atlas},
|
||||
codepoint_resolver::{CodepointResolver, RenderGlyphError},
|
||||
collection::{self, Collection, GetFaceError, Index, PresentationMode},
|
||||
face::{Constraint, ConstraintSize, RenderOptions},
|
||||
};
|
||||
|
||||
/// The size of a grid cell in pixels.
|
||||
// TODO(integration): replace with `renderer::CellSize` once the renderer
|
||||
@@ -386,9 +394,13 @@ impl State {
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::collection::{AddOptions, LoadOptions, SizeAdjustment};
|
||||
use crate::face::{DesiredSize, Options};
|
||||
use crate::{Face, Library, embedded};
|
||||
use crate::{
|
||||
Face,
|
||||
Library,
|
||||
collection::{AddOptions, LoadOptions, SizeAdjustment},
|
||||
embedded,
|
||||
face::{DesiredSize, Options},
|
||||
};
|
||||
|
||||
fn test_grid(lib: &Library) -> SharedGrid {
|
||||
let mut c = Collection::new();
|
||||
|
||||
@@ -8,28 +8,38 @@
|
||||
//! This structure is thread-safe when the operations are documented
|
||||
//! as thread-safe.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||
use std::sync::{Arc, Mutex, MutexGuard};
|
||||
|
||||
use ghostty_config::config::Config;
|
||||
use ghostty_config::font_types::Variation;
|
||||
use ghostty_config::font_types::VariationId;
|
||||
use ghostty_config::types_a::{
|
||||
FontStyle, FontSyntheticStyle, RepeatableCodepointMap, RepeatableFontVariation,
|
||||
RepeatableString,
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
hash::{DefaultHasher, Hash, Hasher},
|
||||
sync::{Arc, Mutex, MutexGuard},
|
||||
};
|
||||
use ghostty_config::types_b::FreetypeLoadFlags;
|
||||
|
||||
use crate::codepoint_map::CodepointMap;
|
||||
use crate::codepoint_resolver::{CodepointResolver, StyleStatus};
|
||||
use crate::collection::{self, AddOptions, Collection, LoadOptions, SizeAdjustment};
|
||||
use crate::discovery::{Descriptor, Discover, Fontconfig};
|
||||
use crate::face::{self, DesiredSize, FontData};
|
||||
use crate::library::{Library, LibraryError};
|
||||
use crate::metrics::{Key as MetricsKey, Modifier, ModifierSet};
|
||||
use crate::shared_grid::{self, SharedGrid};
|
||||
use crate::{Face, Style, embedded};
|
||||
use ghostty_config::{
|
||||
config::Config,
|
||||
font_types::{Variation, VariationId},
|
||||
types_a::{
|
||||
FontStyle,
|
||||
FontSyntheticStyle,
|
||||
RepeatableCodepointMap,
|
||||
RepeatableFontVariation,
|
||||
RepeatableString,
|
||||
},
|
||||
types_b::FreetypeLoadFlags,
|
||||
};
|
||||
|
||||
use crate::{
|
||||
Face,
|
||||
Style,
|
||||
codepoint_map::CodepointMap,
|
||||
codepoint_resolver::{CodepointResolver, StyleStatus},
|
||||
collection::{self, AddOptions, Collection, LoadOptions, SizeAdjustment},
|
||||
discovery::{Descriptor, Discover, Fontconfig},
|
||||
embedded,
|
||||
face::{self, DesiredSize, FontData},
|
||||
library::{Library, LibraryError},
|
||||
metrics::{Key as MetricsKey, Modifier, ModifierSet},
|
||||
shared_grid::{self, SharedGrid},
|
||||
};
|
||||
|
||||
/// Errors from [`SharedGridSet::ref_`].
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
|
||||
@@ -7,11 +7,27 @@
|
||||
//! Port of `sprite/draw/block.zig`.
|
||||
|
||||
use super::common::{
|
||||
Alignment, DrawFn, FIVE_EIGHTHS, Fraction, HALF, HAlign, ONE_EIGHTH, ONE_QUARTER, Quads, Range,
|
||||
SEVEN_EIGHTHS, Shade, THREE_EIGHTHS, THREE_QUARTERS, VAlign, fill,
|
||||
Alignment,
|
||||
DrawFn,
|
||||
FIVE_EIGHTHS,
|
||||
Fraction,
|
||||
HALF,
|
||||
HAlign,
|
||||
ONE_EIGHTH,
|
||||
ONE_QUARTER,
|
||||
Quads,
|
||||
Range,
|
||||
SEVEN_EIGHTHS,
|
||||
Shade,
|
||||
THREE_EIGHTHS,
|
||||
THREE_QUARTERS,
|
||||
VAlign,
|
||||
fill,
|
||||
};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, Color, DrawError, Rect},
|
||||
};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, Color, DrawError, Rect};
|
||||
|
||||
pub const RANGES: &[Range] = &[Range {
|
||||
min: 0x2580,
|
||||
|
||||
@@ -15,8 +15,10 @@
|
||||
#![allow(clippy::needless_update)]
|
||||
|
||||
use super::common::{Corner, DrawFn, Range, Thickness, hline, hline_middle, vline, vline_middle};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, CapMode, Color, DrawError, Line, Path, Point, StrokeOptions};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Line, Path, Point, StrokeOptions},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[Range {
|
||||
min: 0x2500,
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
//! Port of `sprite/draw/braille.zig`.
|
||||
|
||||
use super::common::{DrawFn, Range};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, Color, DrawError};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, Color, DrawError},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[Range {
|
||||
min: 0x2800,
|
||||
|
||||
@@ -14,10 +14,14 @@
|
||||
|
||||
use std::f64::consts::PI;
|
||||
|
||||
use super::box_;
|
||||
use super::common::{Corner, DrawFn, Edge, Range, Shade, Thickness, hline_middle, vline_middle};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions};
|
||||
use super::{
|
||||
box_,
|
||||
common::{Corner, DrawFn, Edge, Range, Shade, Thickness, hline_middle, vline_middle},
|
||||
};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[Range {
|
||||
min: 0xf5d0,
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
//! are generally applicable to multiple sets of glyphs
|
||||
//! rather than being single-use. Port of `sprite/draw/common.zig`.
|
||||
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, Color, DrawError};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, Color, DrawError},
|
||||
};
|
||||
|
||||
/// A function that draws a glyph on the provided canvas.
|
||||
pub type DrawFn = fn(
|
||||
|
||||
@@ -14,8 +14,10 @@
|
||||
//! Port of `sprite/draw/geometric_shapes.zig`.
|
||||
|
||||
use super::common::{Corner, DrawFn, Range, Shade, Thickness};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[
|
||||
Range {
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
|
||||
use std::f64::consts::SQRT_2;
|
||||
|
||||
use super::box_;
|
||||
use super::common::{DrawFn, Range, Thickness};
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{
|
||||
Canvas, CapMode, Color, DrawError, Path, Point, StrokeOptions, Triangle,
|
||||
use super::{
|
||||
box_,
|
||||
common::{DrawFn, Range, Thickness},
|
||||
};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, Point, StrokeOptions, Triangle},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[
|
||||
|
||||
@@ -6,8 +6,10 @@
|
||||
|
||||
use std::f64::consts::{FRAC_1_SQRT_2, PI, TAU};
|
||||
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, Rect, StrokeOptions};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, Rect, StrokeOptions},
|
||||
};
|
||||
|
||||
pub fn underline(
|
||||
_cp: u32,
|
||||
|
||||
@@ -3,16 +3,38 @@
|
||||
//!
|
||||
//! Port of `sprite/draw/symbols_for_legacy_computing.zig`.
|
||||
|
||||
use super::block;
|
||||
use super::box_;
|
||||
use super::common::{
|
||||
Alignment, Corner, DrawFn, Edge, FIVE_EIGHTHS, Fraction, HALF, HAlign, ONE_EIGHTH, ONE_QUARTER,
|
||||
ONE_THIRD, Quads, Range, SEVEN_EIGHTHS, Shade, THREE_EIGHTHS, THREE_QUARTERS, TWO_THIRDS,
|
||||
Thickness, VAlign, fill,
|
||||
use super::{
|
||||
block,
|
||||
box_,
|
||||
common::{
|
||||
Alignment,
|
||||
Corner,
|
||||
DrawFn,
|
||||
Edge,
|
||||
FIVE_EIGHTHS,
|
||||
Fraction,
|
||||
HALF,
|
||||
HAlign,
|
||||
ONE_EIGHTH,
|
||||
ONE_QUARTER,
|
||||
ONE_THIRD,
|
||||
Quads,
|
||||
Range,
|
||||
SEVEN_EIGHTHS,
|
||||
Shade,
|
||||
THREE_EIGHTHS,
|
||||
THREE_QUARTERS,
|
||||
TWO_THIRDS,
|
||||
Thickness,
|
||||
VAlign,
|
||||
fill,
|
||||
},
|
||||
geometric_shapes as geo,
|
||||
};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, Color, DrawError, Line, Path, Point, Rect, StrokeOptions},
|
||||
};
|
||||
use super::geometric_shapes as geo;
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, Color, DrawError, Line, Path, Point, Rect, StrokeOptions};
|
||||
|
||||
const _: (f64, f64) = (ONE_THIRD, TWO_THIRDS);
|
||||
|
||||
|
||||
@@ -5,11 +5,15 @@
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use super::box_::{self, Lines, Style};
|
||||
use super::common::{Alignment, Corner, DrawFn, Fraction, Range, fill};
|
||||
use super::symbols_for_legacy_computing as sflc;
|
||||
use crate::metrics::Metrics;
|
||||
use crate::sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions};
|
||||
use super::{
|
||||
box_::{self, Lines, Style},
|
||||
common::{Alignment, Corner, DrawFn, Fraction, Range, fill},
|
||||
symbols_for_legacy_computing as sflc,
|
||||
};
|
||||
use crate::{
|
||||
metrics::Metrics,
|
||||
sprite::canvas::{Canvas, CapMode, Color, DrawError, Path, StrokeOptions},
|
||||
};
|
||||
|
||||
pub const RANGES: &[Range] = &[
|
||||
Range {
|
||||
|
||||
@@ -15,19 +15,28 @@
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
use super::Sprite;
|
||||
use super::canvas::{Canvas, DrawError};
|
||||
use super::draw::common::{DrawFn, Range};
|
||||
use super::draw::{
|
||||
block, box_, braille, branch, geometric_shapes, powerline, special,
|
||||
symbols_for_legacy_computing, symbols_for_legacy_computing_supplement,
|
||||
use super::{
|
||||
Sprite,
|
||||
canvas::{Canvas, DrawError},
|
||||
draw::{
|
||||
block,
|
||||
box_,
|
||||
braille,
|
||||
branch,
|
||||
common::{DrawFn, Range},
|
||||
geometric_shapes,
|
||||
powerline,
|
||||
special,
|
||||
symbols_for_legacy_computing,
|
||||
symbols_for_legacy_computing_supplement,
|
||||
},
|
||||
};
|
||||
pub use crate::{Presentation, face::RenderOptions};
|
||||
use crate::{
|
||||
atlas::{self, Atlas},
|
||||
glyph::Glyph,
|
||||
metrics::Metrics,
|
||||
};
|
||||
use crate::atlas::{self, Atlas};
|
||||
use crate::glyph::Glyph;
|
||||
use crate::metrics::Metrics;
|
||||
|
||||
pub use crate::Presentation;
|
||||
pub use crate::face::RenderOptions;
|
||||
|
||||
/// Errors from [`Face::render_glyph`].
|
||||
#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
|
||||
|
||||
Reference in new issue
Block a user