Skip to content

Commit

Permalink
Simplify re-exports paths
Browse files Browse the repository at this point in the history
  • Loading branch information
grovesNL committed Jan 30, 2023
1 parent 658fcf4 commit 288cd89
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0 OR Zlib"
[dependencies]
wgpu = "0.14.0"
etagere = "0.2.6"
cosmic-text = { git = "https://github.com/pop-os/cosmic-text", rev = "a5903bb" }
cosmic-text = { git = "https://github.com/pop-os/cosmic-text", rev = "a5903bb", features = ["std", "swash"] }

[dev-dependencies]
winit = "0.27.0"
Expand Down
6 changes: 4 additions & 2 deletions examples/hello-world.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use cosmic_text::{Attrs, Buffer, Color, Family, FontSystem, Metrics, SwashCache};
use glyphon::{Resolution, TextArea, TextAtlas, TextBounds, TextRenderer};
use glyphon::{
Attrs, Buffer, Color, Family, FontSystem, Metrics, Resolution, SwashCache, TextArea, TextAtlas,
TextBounds, TextRenderer,
};
use wgpu::{
Backends, CommandEncoderDescriptor, CompositeAlphaMode, DeviceDescriptor, Features, Instance,
Limits, LoadOp, Operations, PresentMode, RenderPassColorAttachment, RenderPassDescriptor,
Expand Down
12 changes: 10 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ pub use text_atlas::TextAtlas;
use text_render::ContentType;
pub use text_render::TextRenderer;

pub use cosmic_text;
// Re-export all top-level types from `cosmic-text` for convenience.
pub use cosmic_text::{
self, fontdb, Action, Affinity, Attrs, AttrsList, AttrsOwned, Buffer, BufferLine, CacheKey,
Color, Command, Cursor, Edit, Editor, Family, FamilyOwned, Font, FontMatches, FontSystem,
LayoutCursor, LayoutGlyph, LayoutLine, LayoutRun, LayoutRunIter, Metrics, ShapeGlyph,
ShapeLine, ShapeSpan, ShapeWord, Stretch, Style, SubpixelBin, SwashCache, SwashContent,
SwashImage, Weight, Wrap,
};

use etagere::AllocId;

pub(crate) enum GpuCacheStatus {
Expand Down Expand Up @@ -85,7 +93,7 @@ impl Default for TextBounds {
/// A text area containing text to be rendered along with its overflow behavior.
pub struct TextArea<'a, 'b: 'a> {
/// The buffer containing the text to be rendered.
pub buffer: &'a cosmic_text::Buffer<'b>,
pub buffer: &'a Buffer<'b>,
/// The left edge of the buffer.
pub left: i32,
/// The top edge of the buffer.
Expand Down
6 changes: 3 additions & 3 deletions src/text_atlas.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
text_render::ContentType, GlyphDetails, GlyphToRender, Params, RecentlyUsedMap, Resolution,
text_render::ContentType, CacheKey, GlyphDetails, GlyphToRender, Params, RecentlyUsedMap,
Resolution,
};
use cosmic_text::CacheKey;
use etagere::{size2, Allocation, BucketedAtlasAllocator};
use std::{borrow::Cow, mem::size_of, num::NonZeroU64, sync::Arc};
use wgpu::{
Expand Down Expand Up @@ -144,7 +144,7 @@ impl TextAtlas {
format: VertexFormat::Uint32,
offset: size_of::<u32>() as u64 * 5,
shader_location: 4,
}
},
],
}];

Expand Down
5 changes: 2 additions & 3 deletions src/text_render.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{
GlyphDetails, GlyphToRender, GpuCacheStatus, Params, PrepareError, RenderError, Resolution,
TextArea, TextAtlas,
CacheKey, Color, GlyphDetails, GlyphToRender, GpuCacheStatus, Params, PrepareError,
RenderError, Resolution, SwashCache, SwashContent, TextArea, TextAtlas,
};
use cosmic_text::{CacheKey, Color, SwashCache, SwashContent};
use std::{collections::HashSet, iter, mem::size_of, num::NonZeroU32, slice};
use wgpu::{
Buffer, BufferDescriptor, BufferUsages, Device, Extent3d, ImageCopyTexture, ImageDataLayout,
Expand Down

0 comments on commit 288cd89

Please sign in to comment.