Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion core/src/backend/ui.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use crate::loader::Error as DialogLoaderError;
use crate::{
backend::navigator::OwnedFuture,
font::{FontFileData, FontQuery},
font::{FontFileData, FontQuery, FontRenderer},
};
use chrono::{DateTime, Utc};
use fluent_templates::loader::langid;
Expand All @@ -24,6 +24,14 @@ pub enum FontDefinition<'a> {
data: FontFileData,
index: u32,
},

/// Font rendered externally.
ExternalRenderer {
name: String,
is_bold: bool,
is_italic: bool,
font_renderer: Box<dyn FontRenderer>,
},
}

/// A filter specifying a category that can be selected from a file chooser dialog
Expand Down
14 changes: 5 additions & 9 deletions core/src/display_object/edit_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::events::{
ClipEvent, ClipEventResult, ImeCursorArea, ImeEvent, ImeNotification, ImePurpose,
PlayerNotification, TextControlCode,
};
use crate::font::{FontLike, FontType, Glyph, TextRenderSettings};
use crate::font::{FontLike, FontType, TextRenderSettings};
use crate::html;
use crate::html::StyleSheet;
use crate::html::{
Expand Down Expand Up @@ -1272,8 +1272,8 @@ impl<'gc> EditText<'gc> {
text,
self.text_transform(color),
params,
|pos, transform, glyph: &Glyph, advance, x| {
if let Some(glyph_shape_handle) = glyph.shape_handle(context.renderer) {
|pos, transform, glyph, advance, x| {
if glyph.renderable(context) {
// If it's highlighted, override the color.
if matches!(visible_selection, Some(visible_selection) if visible_selection.contains(start + pos)) {
// Set text color to white
Expand All @@ -1285,11 +1285,7 @@ impl<'gc> EditText<'gc> {
} else {
context.transform_stack.push(transform);
}

// Render glyph.
context
.commands
.render_shape(glyph_shape_handle, context.transform_stack.transform());
glyph.render(context);
context.transform_stack.pop();
}

Expand Down Expand Up @@ -1629,7 +1625,7 @@ impl<'gc> EditText<'gc> {
text,
self.text_transform(color),
params,
|pos, _transform, _glyph: &Glyph, advance, x| {
|pos, _transform, _glyph, advance, x| {
if local_position.x >= x {
if local_position.x > x + (advance / 2) {
result = string_utils::next_char_boundary(text, pos);
Expand Down
8 changes: 2 additions & 6 deletions core/src/display_object/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use gc_arena::barrier::unlock;
use gc_arena::Lock;
use gc_arena::{Collect, Gc, Mutation};
use ruffle_common::utils::HasPrefixField;
use ruffle_render::commands::CommandHandler;
use ruffle_render::transform::Transform;
use ruffle_wstr::WString;
use std::cell::RefCell;
Expand Down Expand Up @@ -166,12 +165,9 @@ impl<'gc> TDisplayObject<'gc> for Text<'gc> {
transform.color_transform.set_mult_color(color);
for c in &block.glyphs {
if let Some(glyph) = font.get_glyph(c.index as usize) {
if let Some(glyph_shape_handle) = glyph.shape_handle(context.renderer) {
if glyph.renderable(context) {
context.transform_stack.push(&transform);
context.commands.render_shape(
glyph_shape_handle,
context.transform_stack.transform(),
);
glyph.render(context);
context.transform_stack.pop();
}

Expand Down
Loading
Loading