Ejemplo n.º 1
0
Archivo: Wtext.py Proyecto: mmrvka/xbmc
def GetFNum(fontname):
    """Same as Fm.GetFNum(), but maps a missing font to Monaco instead of the system font."""
    if fontname <> Fm.GetFontName(0):
        fontid = Fm.GetFNum(fontname)
        if fontid == 0:
            fontid = Fonts.monaco
    else:
        fontid = 0
    return fontid
Ejemplo n.º 2
0
 def getruninfo(self):
     all = (WASTEconst.weDoFont | WASTEconst.weDoFace | WASTEconst.weDoSize)
     dummy, mode, (font, face, size,
                   color) = self.ted.WEContinuousStyle(all)
     if not (mode & WASTEconst.weDoFont):
         font = None
     else:
         font = Fm.GetFontName(font)
     if not (mode & WASTEconst.weDoFace): fact = None
     if not (mode & WASTEconst.weDoSize): size = None
     return font, face, size
Ejemplo n.º 3
0
# A minimal text editor.
Ejemplo n.º 4
0
def getfontnames():
    names = []
    for i in range(256):
        n = Fm.GetFontName(i)
        if n: names.append(n)
    return names
Ejemplo n.º 5
0
Archivo: Wtext.py Proyecto: mmrvka/xbmc
 def getfontsettings(self):
     from Carbon import Res
     (font, style, size, color) = self.ted.WEGetRunInfo(0)[4]
     font = Fm.GetFontName(font)
     return (font, style, size, color)
Ejemplo n.º 6
0
Archivo: Wtext.py Proyecto: mmrvka/xbmc
def GetPortFontSettings(port):
    return Fm.GetFontName(port.GetPortTextFont()), port.GetPortTextFace(
    ), port.GetPortTextSize()
Ejemplo n.º 7
0
Archivo: Wtext.py Proyecto: mmrvka/xbmc
            tabsize = max(tabsize, 1)
            self.ted.WESetTabSize(tabsize)
            self.SetPort()
            Qd.EraseRect(self.ted.WEGetViewRect())
            self.ted.WEUpdate(port.visRgn)

    def getfontsettings(self):
        from Carbon import Res
        (font, style, size, color) = self.ted.WEGetRunInfo(0)[4]
        font = Fm.GetFontName(font)
        return (font, style, size, color)

    def setfontsettings(self, (font, style, size, color)):
        self.SetPort()
        if type(font) <> StringType:
            font = Fm.GetFontName(font)
        self.fontsettings = (font, style, size, color)
        fontid = GetFNum(font)
        readonly = self.ted.WEFeatureFlag(WASTEconst.weFReadOnly, -1)
        if readonly:
            self.ted.WEFeatureFlag(WASTEconst.weFReadOnly, 0)
        try:
            self.ted.WEFeatureFlag(WASTEconst.weFInhibitRecal, 1)
            selstart, selend = self.ted.WEGetSelection()
            self.ted.WESetSelection(0, self.ted.WEGetTextLength())
            self.ted.WESetStyle(WASTEconst.weDoFace, (0, 0, 0, (0, 0, 0)))
            self.ted.WESetStyle(
                WASTEconst.weDoFace | WASTEconst.weDoColor
                | WASTEconst.weDoFont | WASTEconst.weDoSize,
                (fontid, style, size, color))
            self.ted.WEFeatureFlag(WASTEconst.weFInhibitRecal, 0)