From 4a093c25a70c710e5d1b87cde7a459a82aff7c8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 11 Jan 2018 23:22:02 +0100 Subject: [PATCH] =?UTF-8?q?MiRCARTToPngFile.py:export():=20treat=20`?= =?UTF-8?q?=E2=96=88'=20as=20whitespace=20w/=20inverse=20colours.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MiRCARTToPngFile.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/MiRCARTToPngFile.py b/MiRCARTToPngFile.py index de875b0..a5f6a12 100755 --- a/MiRCARTToPngFile.py +++ b/MiRCARTToPngFile.py @@ -92,17 +92,27 @@ class MiRCARTToPngFile: outColours = [0, 0] if inCurCell[1] & 0x02: if inCurCell[2] != " ": - outColours[0] = self._ColourMapBold[inCurCell[0][0]] - outColours[1] = self._ColourMapBold[inCurCell[0][1]] + if inCurCell[2] == "█": + outColours[1] = self._ColourMapBold[inCurCell[0][0]] + else: + outColours[0] = self._ColourMapBold[inCurCell[0][0]] + outColours[1] = self._ColourMapBold[inCurCell[0][1]] + else: + outColours[1] = self._ColourMapBold[inCurCell[0][1]] else: if inCurCell[2] != " ": - outColours[0] = self._ColourMapNormal[inCurCell[0][0]] - outColours[1] = self._ColourMapNormal[inCurCell[0][1]] + if inCurCell[2] == "█": + outColours[1] = self._ColourMapNormal[inCurCell[0][0]] + else: + outColours[0] = self._ColourMapNormal[inCurCell[0][0]] + outColours[1] = self._ColourMapNormal[inCurCell[0][1]] + else: + outColours[1] = self._ColourMapNormal[inCurCell[0][1]] outImgDraw.rectangle((*outCurPos, \ outCurPos[0] + self.outImgFontSize[0], \ outCurPos[1] + self.outImgFontSize[1]), \ fill=(*outColours[1], 255)) - if inCurCell[2] != " " \ + if not inCurCell[2] in " █" \ and outColours[0] != outColours[1]: # XXX implement italic outImgDraw.text(outCurPos, \