Skip to content
Snippets Groups Projects
Commit f69ff657 authored by John Mitchell's avatar John Mitchell
Browse files

Fixed text color extraction.

parent ccf067d2
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ fn my_widget_1_render( ...@@ -18,6 +18,7 @@ fn my_widget_1_render(
// Note: We will see two updates because of the mutable change to styles. // Note: We will see two updates because of the mutable change to styles.
// Which means when foo changes MyWidget will render twice! // Which means when foo changes MyWidget will render twice!
*computed_styles = KStyle { *computed_styles = KStyle {
color: Color::RED.into(),
render_command: StyleProp::Value(RenderCommand::Text { render_command: StyleProp::Value(RenderCommand::Text {
content: format!("My number is: {}", my_widget.foo), content: format!("My number is: {}", my_widget.foo),
alignment: Alignment::Start, alignment: Alignment::Start,
......
...@@ -13,7 +13,7 @@ use super::font_mapping::FontMapping; ...@@ -13,7 +13,7 @@ use super::font_mapping::FontMapping;
pub fn extract_texts( pub fn extract_texts(
camera_entity: Entity, camera_entity: Entity,
background_color: Color, color: Color,
text_layout: TextLayout, text_layout: TextLayout,
layout: crate::layout::Rect, layout: crate::layout::Rect,
font: String, font: String,
...@@ -51,7 +51,7 @@ pub fn extract_texts( ...@@ -51,7 +51,7 @@ pub fn extract_texts(
min: position, min: position,
max: position + size, max: position + size,
}, },
color: background_color, color,
char_id: font.get_char_id(glyph_rect.content).unwrap(), char_id: font.get_char_id(glyph_rect.content).unwrap(),
z_index: layout.z_index, z_index: layout.z_index,
quad_type: if subpixel || forced { quad_type: if subpixel || forced {
......
...@@ -117,9 +117,10 @@ impl RenderPrimitive for KStyle { ...@@ -117,9 +117,10 @@ impl RenderPrimitive for KStyle {
let font = self let font = self
.font .font
.resolve_or_else(|| String::from(crate::DEFAULT_FONT)); .resolve_or_else(|| String::from(crate::DEFAULT_FONT));
let color = self.color.resolve_or(Color::WHITE);
let text = crate::render::font::extract_texts( let text = crate::render::font::extract_texts(
camera_entity, camera_entity,
background_color, color,
text_layout, text_layout,
*layout, *layout,
font, font,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment