[lasem] underover: fix the form of script elements of underover and script.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] underover: fix the form of script elements of underover and script.
- Date: Wed, 18 Apr 2012 12:29:10 +0000 (UTC)
commit 4efb1a91bd595d8bc5a717b1ae245684299f7cd0
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Wed Apr 18 14:27:49 2012 +0200
underover: fix the form of script elements of underover and script.
Default form is postfix for elements in script position.
src/lsmmathmloperatordictionary.c | 27 ++++++++++++++++++++++++---
src/lsmmathmloperatorelement.c | 28 +++++++++++++++++++---------
src/lsmmathmlunderoverelement.c | 9 ++++-----
3 files changed, 47 insertions(+), 17 deletions(-)
---
diff --git a/src/lsmmathmloperatordictionary.c b/src/lsmmathmloperatordictionary.c
index 067eb0e..9490c2f 100644
--- a/src/lsmmathmloperatordictionary.c
+++ b/src/lsmmathmloperatordictionary.c
@@ -2768,6 +2768,15 @@ static const LsmMathmlOperatorDictionaryEntry lsm_mathml_operator_entries[] = {
TRUE
},
{
+ "^", LSM_MATHML_FORM_POSTFIX,
+ { LSM_MATHML_SPACE_NAME_ERROR, { 0.0, LSM_MATHML_UNIT_EM}},
+ { LSM_MATHML_SPACE_NAME_ERROR, { 0.0, LSM_MATHML_UNIT_EM}},
+ TRUE, FALSE, TRUE, FALSE, FALSE, FALSE,
+ { LSM_MATHML_SPACE_NAME_ERROR, { 1, LSM_MATHML_UNIT_PX}},
+ { LSM_MATHML_SPACE_NAME_INFINITY, {0.0, 0}},
+ TRUE
+ },
+ {
"<>", LSM_MATHML_FORM_INFIX,
{ LSM_MATHML_SPACE_NAME_VERY_THIN, { 0.0, 0}},
{ LSM_MATHML_SPACE_NAME_VERY_THIN, { 0.0, 0}},
@@ -3256,8 +3265,11 @@ lsm_mathml_operator_dictionary_lookup (const char *utf8, LsmMathmlForm form)
entry = g_hash_table_lookup (_get_operator_dictionary (), key);
g_free (key);
- if (entry != NULL)
+ if (entry != NULL) {
+ lsm_debug_update ("[OperatorDictionary::lookup] Return infix entry instead of %s for %s",
+ prefix, utf8);
return entry;
+ }
}
if (form != LSM_MATHML_FORM_POSTFIX) {
@@ -3265,8 +3277,11 @@ lsm_mathml_operator_dictionary_lookup (const char *utf8, LsmMathmlForm form)
entry = g_hash_table_lookup (_get_operator_dictionary (), key);
g_free (key);
- if (entry != NULL)
+ if (entry != NULL) {
+ lsm_debug_update ("[OperatorDictionary::lookup] Return postfix entry instead of %s for %s",
+ prefix, utf8);
return entry;
+ }
}
if (form != LSM_MATHML_FORM_PREFIX) {
@@ -3274,9 +3289,15 @@ lsm_mathml_operator_dictionary_lookup (const char *utf8, LsmMathmlForm form)
entry = g_hash_table_lookup (_get_operator_dictionary (), key);
g_free (key);
- if (entry != NULL)
+ if (entry != NULL) {
+ lsm_debug_update ("[OperatorDictionary::lookup] Return prefix entry instead of %s for %s",
+ prefix, utf8);
return entry;
+ }
}
+ lsm_debug_update ("[OperatorDictionary::lookup] Return default entry instead of %s for %s",
+ prefix, utf8);
+
return &lsm_mathml_operator_dictionary_default_entry;
}
diff --git a/src/lsmmathmloperatorelement.c b/src/lsmmathmloperatorelement.c
index c1e6499..63158d3 100644
--- a/src/lsmmathmloperatorelement.c
+++ b/src/lsmmathmloperatorelement.c
@@ -24,6 +24,8 @@
#include <lsmdebug.h>
#include <lsmmathmloperatorelement.h>
#include <lsmmathmloperatordictionary.h>
+#include <lsmmathmlunderoverelement.h>
+#include <lsmmathmlscriptelement.h>
#include <lsmmathmlview.h>
static GObject *parent_class;
@@ -52,15 +54,23 @@ lsm_mathml_operator_element_dictionary_lookup (LsmMathmlOperatorElement *operato
text = lsm_mathml_presentation_token_get_text (LSM_MATHML_PRESENTATION_TOKEN (operator));
- if (LSM_IS_MATHML_ELEMENT (node->parent_node) &&
- lsm_mathml_element_is_inferred_row (LSM_MATHML_ELEMENT (node->parent_node))) {
- if ((node->previous_sibling != NULL && node->next_sibling != NULL) ||
- (node->previous_sibling == NULL && node->next_sibling == NULL))
- form = LSM_MATHML_FORM_INFIX;
- else if (node->previous_sibling == NULL)
- form = LSM_MATHML_FORM_PREFIX;
- else
- form = LSM_MATHML_FORM_POSTFIX;
+ if (LSM_IS_MATHML_ELEMENT (node->parent_node)) {
+ if (lsm_mathml_element_is_inferred_row (LSM_MATHML_ELEMENT (node->parent_node))) {
+ if ((node->previous_sibling != NULL && node->next_sibling != NULL) ||
+ (node->previous_sibling == NULL && node->next_sibling == NULL))
+ form = LSM_MATHML_FORM_INFIX;
+ else if (node->previous_sibling == NULL)
+ form = LSM_MATHML_FORM_PREFIX;
+ else
+ form = LSM_MATHML_FORM_POSTFIX;
+ } else if (LSM_IS_MATHML_UNDER_OVER_ELEMENT (node->parent_node) &&
+ node->previous_sibling != NULL) {
+ form = LSM_MATHML_FORM_POSTFIX;
+ } else if (LSM_IS_MATHML_SCRIPT_ELEMENT (node->parent_node) &&
+ node->previous_sibling != NULL) {
+ form = LSM_MATHML_FORM_POSTFIX;
+ } else
+ form = LSM_MATHML_FORM_INFIX;
} else
form = LSM_MATHML_FORM_INFIX;
diff --git a/src/lsmmathmlunderoverelement.c b/src/lsmmathmlunderoverelement.c
index 2cdc8cc..fbad37f 100644
--- a/src/lsmmathmlunderoverelement.c
+++ b/src/lsmmathmlunderoverelement.c
@@ -152,7 +152,7 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
operator = lsm_mathml_element_get_embellished_core (under_over->underscript);
if (operator != NULL) {
accent_under = operator->accent.value;
- lsm_debug_update ("[UnderOver::update] Underscript is%s accent (%s)",
+ lsm_debug_update ("[UnderOver::update] Underscript is%s an accent (%s)",
accent_under ? "" : " not",
lsm_dom_node_get_node_name (LSM_DOM_NODE (operator)));
}
@@ -172,10 +172,9 @@ lsm_mathml_under_over_element_update_children (LsmMathmlElement *self, LsmMathml
operator = lsm_mathml_element_get_embellished_core (under_over->overscript);
if (operator != NULL) {
accent = operator->accent.value;
- if (accent)
- lsm_debug_update ("[UnderOver::update] Overscript is%s accent (%s)",
- accent ? "" : " not",
- lsm_dom_node_get_node_name (LSM_DOM_NODE (operator)));
+ lsm_debug_update ("[UnderOver::update] Overscript is%s an accent (%s)",
+ accent ? "" : " not",
+ lsm_dom_node_get_node_name (LSM_DOM_NODE (operator)));
}
accent = lsm_mathml_boolean_attribute_inherit (&under_over->accent, accent);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]