From 3909fb91e63dd6c90371ebe8a3dd40309625ed2d Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Thu, 28 Aug 2008 07:10:48 +1000 Subject: [PATCH] Handle 'newline' to start new line of text. 'newline' is a straigth line: to-right to bottom left. --- scribble.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scribble.py b/scribble.py index e30198a..2707b23 100755 --- a/scribble.py +++ b/scribble.py @@ -172,6 +172,7 @@ def LoadDict(dict): dict.add('_', "S(4)3,5.S(4)5,3.S(4)3,5") dict.add("", "S(4)5,3.S(3)3,5") dict.add("","S(4)3,5.S(5)5,3") + dict.add("", "S(4)2,6") class DictSegment: @@ -866,6 +867,15 @@ class ScribblePad: elif sym == "": if self.textcurs < len(self.textstr): self.textcurs += 1 + elif sym == "": + self.flush_text() + self.textcurs = 0 + self.textstr = "" + ctx = self.page.get_pango_context() + ascent = ctx.get_metrics(ctx.get_font_description()).get_ascent() + descent = ctx.get_metrics(ctx.get_font_description()).get_descent() + self.textpos = [ self.textpos[0], self.textpos[1] + + (ascent + descent) / pango.SCALE ] else: self.textstr = self.textstr[0:self.textcurs] + sym + \ self.textstr[self.textcurs:] @@ -915,7 +925,7 @@ class ScribblePad: if type(l[2]) == str: self.draw_text(st, col, l[2]) - if self.textstr: + if self.textstr != None: self.draw_text(self.textpos, self.colour, self.textstr, self.textcurs) -- 2.39.5