mirror of
https://github.com/lalbornoz/roar.git
synced 2024-11-26 00:46:38 +00:00
libgui/GuiCanvasWxBackend.py:resize(): load font named by fontName instead of wx.FONTFAMILY_TELETYPE.
libgui/GuiCanvasWxBackend.py:__init__(): receive & set font{Name,PathName}. libgui/GuiCanvasWxBackend.py:__init__(): call AddFontResourceW() in lieu of WxPython support FOR ANYTHING THAT GOES BEYOND BEING A BLOODY NON-STOP HINDRANCE.
This commit is contained in:
parent
418d16a81a
commit
0f88a78639
@ -4,8 +4,9 @@
|
|||||||
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
# Copyright (c) 2018, 2019 Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de>
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from ctypes import *
|
||||||
from GuiCanvasColours import Colours
|
from GuiCanvasColours import Colours
|
||||||
import math, wx
|
import math, os, wx
|
||||||
|
|
||||||
class GuiBufferedDC(wx.MemoryDC):
|
class GuiBufferedDC(wx.MemoryDC):
|
||||||
# {{{ __del__(self)
|
# {{{ __del__(self)
|
||||||
@ -145,7 +146,7 @@ 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.Font(8, wx.FONTFAMILY_TELETYPE, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)
|
self._font = wx.TheFontList.FindOrCreateFont(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, self.fontName)
|
||||||
# }}}
|
# }}}
|
||||||
# {{{ xlateEventPoint(self, event, eventDc, viewRect)
|
# {{{ xlateEventPoint(self, event, eventDc, viewRect)
|
||||||
def xlateEventPoint(self, event, eventDc, viewRect):
|
def xlateEventPoint(self, event, eventDc, viewRect):
|
||||||
@ -163,10 +164,11 @@ class GuiCanvasWxBackend():
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
#
|
#
|
||||||
# __init__(self, canvasSize, cellSize): initialisation method
|
# __init__(self, canvasSize, cellSize, fontName="Dejavu Sans Mono", fontPathName=os.path.join("assets", "fonts", "DejaVuSansMono.ttf")): initialisation method
|
||||||
def __init__(self, canvasSize, cellSize):
|
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 = None, None
|
self.canvasBitmap, self.cellSize, self.fontName, self.fontPathName = None, None, fontName, fontPathName
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user