diff options
author | gauravp94 <gparida94@gmail.com> | 2014-03-08 13:30:07 (GMT) |
---|---|---|
committer | gauravp94 <gparida94@gmail.com> | 2014-03-08 13:30:07 (GMT) |
commit | ea90ca7b448ec6ec8bfe037b57f7e7b2eddeaeba (patch) | |
tree | 3603a3308e258b85b9a08c37104d88dc699f2b8d | |
parent | 7b53180d699627c887ae20361e0d40c8e32d895a (diff) |
Fix #4735 Sudden increase in the size of the screentry2
-rw-r--r-- | calculate.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/calculate.py b/calculate.py index 6b79e90..971a108 100644 --- a/calculate.py +++ b/calculate.py @@ -137,6 +137,7 @@ class Equation: fontsize = self.determine_font_size(*tags) _logger.debug('font-size: %d', fontsize) tagsuper = buf.create_tag(rise=fontsize/2) + tagsmallnarrow = buf.create_tag(font=CalcLayout.FONT_SMALL_NARROW) ENDSET = list(AstParser.DIADIC_OPS) ENDSET.extend((',', '(', ')')) @@ -144,7 +145,7 @@ class Equation: ofs = 0 while ofs <= len(text) and text.find('**', ofs) != -1: nextofs = text.find('**', ofs) - buf.insert_with_tags(buf.get_end_iter(), text[ofs:nextofs], *tags) + buf.insert_with_tags(buf.get_end_iter(), text[ofs:nextofs], tagsmallnarrow,*tags) nextofs2 = findchar(text, ENDSET, nextofs + 2) _logger.debug('nextofs2: %d, char=%c', nextofs2, text[nextofs2]) if nextofs2 == -1: @@ -154,7 +155,7 @@ class Equation: ofs = nextofs2 if ofs < len(text): - buf.insert_with_tags(buf.get_end_iter(), text[ofs:], *tags) + buf.insert_with_tags(buf.get_end_iter(), text[ofs:], tagsmallnarrow, *tags) def create_lasteq_textbuf(self): ''' @@ -173,13 +174,13 @@ class Equation: # Add label and equation if len(self.label) > 0: labelstr = '%s:' % self.label - buf.insert_with_tags(buf.get_end_iter(), labelstr, tagbignarrow) + buf.insert_with_tags(buf.get_end_iter(), labelstr, tagsmallnarrow) eqnoffset = buf.get_end_iter().get_offset() eqnstr = '%s\n' % str(self.equation) if is_error: - buf.insert_with_tags(buf.get_end_iter(), eqnstr, tagbignarrow) + buf.insert_with_tags(buf.get_end_iter(), eqnstr, tagsmallnarrow) else: - self.append_with_superscript_tags(buf, eqnstr, tagbignarrow) + self.append_with_superscript_tags(buf, eqnstr, tagsmallnarrow) # Add result if type(self.result) in (types.StringType, types.UnicodeType): @@ -195,7 +196,7 @@ class Equation: buf.apply_tag(tagred, eqnstart, eqnend) elif not isinstance(self.result, SVGImage): resstr = self.ml.format_number(self.result) - self.append_with_superscript_tags(buf, resstr, tagbigger, + self.append_with_superscript_tags(buf, resstr, tagsmallnarrow, tagjustright) return buf |