Loading of multiple fonts for bold and italic
This commit is contained in:
parent
e753fc11ca
commit
ef5a811140
@ -86,9 +86,51 @@ func (backend *Backend) drawRune (
|
|||||||
// application background color as the background. that way, we won't
|
// application background color as the background. that way, we won't
|
||||||
// need to redraw the characters *or* composite them.
|
// need to redraw the characters *or* composite them.
|
||||||
|
|
||||||
|
face := backend.font.normal
|
||||||
|
|
||||||
|
highlight := runeStyle & stone.StyleHighlight > 0
|
||||||
|
bold := runeStyle & stone.StyleBold > 0
|
||||||
|
italic := runeStyle & stone.StyleItalic > 0
|
||||||
|
|
||||||
|
boldTransform := false
|
||||||
|
italicTransform := false
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case bold && italic:
|
||||||
|
if backend.font.boldItalic == nil {
|
||||||
|
switch {
|
||||||
|
case
|
||||||
|
backend.font.bold == nil && backend.font.italic != nil,
|
||||||
|
backend.font.bold != nil && backend.font.italic != nil:
|
||||||
|
|
||||||
|
boldTransform = true
|
||||||
|
face = backend.font.italic
|
||||||
|
case backend.font.italic == nil && backend.font.bold != nil:
|
||||||
|
italicTransform = true
|
||||||
|
face = backend.font.bold
|
||||||
|
default:
|
||||||
|
boldTransform = true
|
||||||
|
italicTransform = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
face = backend.font.boldItalic
|
||||||
|
}
|
||||||
|
case bold:
|
||||||
|
if backend.font.bold == nil {
|
||||||
|
boldTransform = true
|
||||||
|
} else {
|
||||||
|
face = backend.font.bold
|
||||||
|
}
|
||||||
|
case italic:
|
||||||
|
if backend.font.italic == nil {
|
||||||
|
italicTransform = true
|
||||||
|
} else {
|
||||||
|
face = backend.font.italic
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var background xgraphics.BGRA
|
var background xgraphics.BGRA
|
||||||
var foreground xgraphics.BGRA
|
var foreground xgraphics.BGRA
|
||||||
highlight := runeStyle & stone.StyleHighlight > 0
|
|
||||||
|
|
||||||
if highlight {
|
if highlight {
|
||||||
background = backend.colors[runeColor]
|
background = backend.colors[runeColor]
|
||||||