[lasem] mathml_view: take math_variant into account for operators.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] mathml_view: take math_variant into account for operators.
- Date: Sat, 10 Dec 2011 13:53:52 +0000 (UTC)
commit 04ffc84cd43542d407f394391e63c2d0f3ecd3df
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Sat Dec 10 14:53:06 2011 +0100
mathml_view: take math_variant into account for operators.
src/lsmmathmlview.c | 33 +++++++++++++++++++++++++++------
1 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/src/lsmmathmlview.c b/src/lsmmathmlview.c
index 144930e..93b0cb1 100644
--- a/src/lsmmathmlview.c
+++ b/src/lsmmathmlview.c
@@ -301,10 +301,17 @@ lsm_mathml_view_update_layout_for_operator (LsmMathmlView *view,
font_description = view->dom_view.font_description;
pango_font_description_set_family (font_description, LSM_MATHML_FONT_SERIF);
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
pango_font_description_set_size (font_description,
style->math_size * PANGO_SCALE * (large ? LSM_MATHML_LARGE_OP_SCALE : 1.0));
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ if (style->math_variant < G_N_ELEMENTS (lsm_mathml_pango_options)) {
+ pango_font_description_set_style (font_description,
+ lsm_mathml_pango_options[style->math_variant].style);
+ pango_font_description_set_weight (font_description,
+ lsm_mathml_pango_options[style->math_variant].weight);
+ } else {
+ pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
+ pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ }
pango_layout_set_text (pango_layout, text, -1);
pango_layout_set_font_description (pango_layout, font_description);
pango_layout_get_extents (pango_layout, ink_rect, rect);
@@ -384,8 +391,15 @@ lsm_mathml_view_measure_operator (LsmMathmlView *view,
for (; i < glyph->n_sized_glyphs; i++) {
font_name = lsm_mathml_font_names [glyph->sized_glyphs[i].font];
pango_font_description_set_family (font_description, font_name);
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ if (style->math_variant < G_N_ELEMENTS (lsm_mathml_pango_options)) {
+ pango_font_description_set_style (font_description,
+ lsm_mathml_pango_options[style->math_variant].style);
+ pango_font_description_set_weight (font_description,
+ lsm_mathml_pango_options[style->math_variant].weight);
+ } else {
+ pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
+ pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ }
pango_layout_set_text (pango_layout, glyph->sized_glyphs[i].utf8, -1);
pango_layout_set_font_description (pango_layout, font_description);
pango_layout_get_extents (pango_layout, &ink_rect, NULL);
@@ -512,8 +526,15 @@ lsm_mathml_view_show_operator (LsmMathmlView *view,
for (; i < glyph->n_sized_glyphs; i++) {
font_name = lsm_mathml_font_names [glyph->sized_glyphs[i].font];
pango_font_description_set_family (font_description, font_name);
- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ if (style->math_variant < G_N_ELEMENTS (lsm_mathml_pango_options)) {
+ pango_font_description_set_style (font_description,
+ lsm_mathml_pango_options[style->math_variant].style);
+ pango_font_description_set_weight (font_description,
+ lsm_mathml_pango_options[style->math_variant].weight);
+ } else {
+ pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL);
+ pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL);
+ }
pango_layout_set_text (pango_layout, glyph->sized_glyphs[i].utf8, -1);
pango_layout_set_font_description (pango_layout, font_description);
pango_layout_get_extents (pango_layout, &ink_rect, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]