libgui/GuiCanvasWxBackend.py:{resize,__init__}(): restrict external font loading to Windows (via sym.)

assets/text/TODO: updated.
This commit is contained in:
Lucio Andrés Illanes Albornoz 2019-09-13 10:03:39 +02:00
parent 6e470c93d0
commit 2c8fa89eda
2 changed files with 8 additions and 4 deletions

View File

@ -7,7 +7,7 @@
7) Incremental auto{load,save} & {backup,restore} (needs Settings window) 7) Incremental auto{load,save} & {backup,restore} (needs Settings window)
8) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...) 8) Sprites & scripted (Python?) animation on the basis of asset traits and {composable,parametrised} patterns (metric flow, particle system, rigging, ...)
9) Composition, parametrisation & keying of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools 9) Composition, parametrisation & keying of tools from higher-order operators (brushes, filters, outlines, patterns & shaders) and unit tools
10) GUI: a) switch to GTK b) replace logo w/ canvas panel in About dialogue c) {copy,cut,insert from,paste}, {edit asset in new canvas,import from canvas} 10) GUI: a) switch to GTK b) replace logo w/ canvas panel in About dialogue c) {copy,cut,insert from,paste}, {edit asset in new canvas,import from canvas} d) replace resize buttons w/ {-,edit box,+} buttons & lock button re: ratio (ty lol3)
High-priority list: High-priority list:
1) geometric primitives: arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star 1) geometric primitives: arrow, circle, cloud/speech bubble, curve, heart, hexagon, line, pentagon, polygon, rhombus, triangle, square, star

View File

@ -6,7 +6,7 @@
from ctypes import * from ctypes import *
from GuiCanvasColours import Colours from GuiCanvasColours import Colours
import math, os, wx import math, os, platform, wx
class GuiBufferedDC(wx.MemoryDC): class GuiBufferedDC(wx.MemoryDC):
# {{{ __del__(self) # {{{ __del__(self)
@ -155,7 +155,10 @@ class GuiCanvasWxBackend():
oldDc.SelectObject(wx.NullBitmap) oldDc.SelectObject(wx.NullBitmap)
self.canvasBitmap.Destroy(); self.canvasBitmap = newBitmap; self.canvasBitmap.Destroy(); self.canvasBitmap = newBitmap;
self.canvasSize, self.cellSize = canvasSize, cellSize self.canvasSize, self.cellSize = canvasSize, cellSize
self._font = wx.TheFontList.FindOrCreateFont(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, self.fontName) if platform.system() == "Windows":
self._font = wx.TheFontList.FindOrCreateFont(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, self.fontName)
else:
self._font = wx.Font(8, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
# }}} # }}}
# {{{ xlateEventPoint(self, event, eventDc, viewRect) # {{{ xlateEventPoint(self, event, eventDc, viewRect)
def xlateEventPoint(self, event, eventDc, viewRect): def xlateEventPoint(self, event, eventDc, viewRect):
@ -177,7 +180,8 @@ class GuiCanvasWxBackend():
def __init__(self, canvasSize, cellSize, fontName="Dejavu Sans Mono", fontPathName=os.path.join("assets", "fonts", "DejaVuSansMono.ttf")): def __init__(self, canvasSize, cellSize, fontName="Dejavu Sans Mono", fontPathName=os.path.join("assets", "fonts", "DejaVuSansMono.ttf")):
self._brushes, self._font, self._lastBrush, self._lastPen, self._pens = None, None, None, None, None self._brushes, self._font, self._lastBrush, self._lastPen, self._pens = None, None, None, None, None
self.canvasBitmap, self.cellSize, self.fontName, self.fontPathName = None, None, fontName, fontPathName self.canvasBitmap, self.cellSize, self.fontName, self.fontPathName = None, None, fontName, fontPathName
WinDLL("gdi32.dll").AddFontResourceW(self.fontPathName.encode("utf16")) if platform.system() == "Windows":
WinDLL("gdi32.dll").AddFontResourceW(self.fontPathName.encode("utf16"))
self._initBrushesAndPens(); self.resize(canvasSize, cellSize); self._initBrushesAndPens(); self.resize(canvasSize, cellSize);
# vim:expandtab foldmethod=marker sw=4 ts=4 tw=120 # vim:expandtab foldmethod=marker sw=4 ts=4 tw=120