first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -7,10 +7,11 @@
|
||||
allow(dead_code)
|
||||
)]
|
||||
|
||||
use owned_ttf_parser::{AsFaceRef, Face, FaceParsingError, OwnedFace};
|
||||
use std::fs::File;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use owned_ttf_parser::{AsFaceRef, Face, FaceParsingError, OwnedFace};
|
||||
|
||||
/// A handle that wraps around a font face.
|
||||
pub struct FontHandle {
|
||||
data: FontData,
|
||||
@@ -85,7 +86,7 @@ impl FontHandle {
|
||||
}
|
||||
}
|
||||
|
||||
/// Validates the the [`FontHandle`] is a parseable font.
|
||||
/// Validates the [`FontHandle`] is a parseable font.
|
||||
pub fn validate_font_data(&self) -> Result<(), Error> {
|
||||
self.data.validate()
|
||||
}
|
||||
|
||||
@@ -6,14 +6,8 @@
|
||||
//! Handles can be converted to owned_ttf_parser::OwnedFace objects
|
||||
//! by loading the fonts into memory.
|
||||
|
||||
use std::ffi::c_int;
|
||||
use std::{collections::HashMap, ffi::CString};
|
||||
|
||||
use super::{
|
||||
font_handle::{Error as FontDataError, FontHandle},
|
||||
FontFamily, ValidateFontSupportsEn,
|
||||
};
|
||||
use crate::fonts::{FontInfo, Properties, Style, Weight};
|
||||
use std::collections::HashMap;
|
||||
use std::ffi::{c_int, CString};
|
||||
|
||||
use fontconfig::{
|
||||
list_fonts, sort_fonts, FontSet, Fontconfig, ObjectSet, Pattern, FC_FAMILY, FC_FILE,
|
||||
@@ -24,6 +18,10 @@ use fontconfig::{
|
||||
};
|
||||
use itertools::Itertools;
|
||||
|
||||
use super::font_handle::{Error as FontDataError, FontHandle};
|
||||
use super::{FontFamily, ValidateFontSupportsEn};
|
||||
use crate::fonts::{FontInfo, Properties, Style, Weight};
|
||||
|
||||
/// Manages font detection and handle generation.
|
||||
///
|
||||
/// Contains our font loading object, wrapping around fontconfig::FontConfig
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
//! Module that rasterizes text using `swash`.
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use cosmic_text::{CacheKey, CacheKeyFlags};
|
||||
use pathfinder_geometry::rect::RectI;
|
||||
use pathfinder_geometry::vector::{vec2i, Vector2F, Vector2I};
|
||||
|
||||
use crate::fonts::canvas::{Canvas, RasterFormat};
|
||||
use crate::fonts::{FontId, GlyphId, RasterizedGlyph, SubpixelAlignment};
|
||||
use crate::platform::FontDB as _;
|
||||
use crate::rendering::GlyphConfig;
|
||||
use crate::windowing::winit::fonts::FontDB;
|
||||
use anyhow::{anyhow, Result};
|
||||
use cosmic_text::{CacheKey, CacheKeyFlags};
|
||||
use pathfinder_geometry::rect::RectI;
|
||||
use pathfinder_geometry::vector::{vec2i, Vector2F, Vector2I};
|
||||
|
||||
impl FontDB {
|
||||
pub(super) fn glyph_raster_bounds(
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use cosmic_text::LayoutGlyph;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
|
||||
use super::str_index_map::StrIndexMap;
|
||||
use crate::fonts::FontId;
|
||||
use crate::text_layout::{Glyph, Run, TextStyle};
|
||||
use cosmic_text::LayoutGlyph;
|
||||
use pathfinder_geometry::vector::vec2f;
|
||||
|
||||
/// Helper struct to construct [`Run`]s from a series of shaped glyphs.
|
||||
pub(super) struct RunBuilder<'a> {
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
use super::{
|
||||
font_handle::FontHandle, FontFamily, LoadedSystemFonts, TextLayoutSystem,
|
||||
ValidateFontSupportsEn,
|
||||
};
|
||||
use crate::fonts::FontId;
|
||||
use anyhow::Result;
|
||||
use font_kit::loader::Loader as _;
|
||||
use font_kit::{
|
||||
family_name::FamilyName as FKFamilyName, properties::Properties as FKProperties,
|
||||
properties::Style as FKStyle, properties::Weight as FKWeight, source::SystemSource as FKSource,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
use owned_ttf_parser::OwnedFace;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
|
||||
use anyhow::Result;
|
||||
use font_kit::family_name::FamilyName as FKFamilyName;
|
||||
use font_kit::loader::Loader as _;
|
||||
use font_kit::properties::{Properties as FKProperties, Style as FKStyle, Weight as FKWeight};
|
||||
use font_kit::source::SystemSource as FKSource;
|
||||
use itertools::Itertools;
|
||||
use owned_ttf_parser::OwnedFace;
|
||||
|
||||
use super::font_handle::FontHandle;
|
||||
use super::{FontFamily, LoadedSystemFonts, TextLayoutSystem, ValidateFontSupportsEn};
|
||||
use crate::fonts::FontId;
|
||||
|
||||
const EN_US_LOCALE: &str = "en-US";
|
||||
|
||||
/// Windows symbol fonts that are used to render window control icons. We specifically do not do any
|
||||
@@ -21,9 +20,8 @@ const EN_US_LOCALE: &str = "en-US";
|
||||
const SYMBOL_ICON_FONTS: &[&str] = &["Segoe Fluent Icons", "Segoe MDL2 Assets"];
|
||||
|
||||
pub(crate) mod loader {
|
||||
use crate::fonts::FontInfo;
|
||||
|
||||
use super::*;
|
||||
use crate::fonts::FontInfo;
|
||||
|
||||
pub fn load_all_system_fonts() -> LoadedSystemFonts {
|
||||
let source = font_kit::source::SystemSource::new();
|
||||
|
||||
Reference in New Issue
Block a user