Skip to content

Commit

Permalink
braille code plane support
Browse files Browse the repository at this point in the history
  • Loading branch information
yatli committed Mar 24, 2022
1 parent 2dc1579 commit d7edd32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Views/Grid.xaml.fs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ type Grid() as this =
// Therefore, we have to break them into single glyphs
// to prevent overflow into later cells.
let hlidchange = prev_hlid <> current.hlid
if hlidchange || mywc <> wc || bold || sym <> mysym then
if hlidchange || mywc <> wc || bold || sym <> mysym || mywc = CharType.Braille then
// If the span split is caused by symbols, we put [x+1]
// into the current span because nr_symbols has latched one rune.
let prev_span = if mysym && not sym && mywc = wc && not bold && not hlidchange
Expand Down
9 changes: 9 additions & 0 deletions ui.fs
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,19 @@ let DefaultFontEmoji =
elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then "Apple Color Emoji"
else "Noto Color Emoji"

let DefaultFontBraille =
if RuntimeInformation.IsOSPlatform(OSPlatform.Windows) then "Segoe UI Symbol"
elif RuntimeInformation.IsOSPlatform(OSPlatform.Linux) then "Monospace" // ?
elif RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then "Menlo" // ?
else "Monospace"


let private nerd_typeface =
let name = if RuntimeInformation.IsOSPlatform(OSPlatform.OSX) then "Iosevka NF"
else "Iosevka"
Typeface($"resm:fvim.Fonts.nerd.ttf?assembly=FVim#{name}")
let private emoji_typeface = Typeface(DefaultFontEmoji)
let private braille_typeface = Typeface(DefaultFontBraille)
let private fontcache = System.Collections.Generic.Dictionary<string*bool*bool, Typeface>()

let InvalidateFontCache () =
Expand Down Expand Up @@ -182,6 +190,7 @@ let GetTypeface(txt, italic, bold, font, wfont) =
| CharType.Powerline
| CharType.Nerd when not states.font_nonerd -> nerd_typeface
| CharType.Emoji -> emoji_typeface
| CharType.Braille -> braille_typeface
| _ -> _get font

let MeasureText (rune: Rune, font: string, wfont: string, fontSize: float, scaling: float) =
Expand Down

0 comments on commit d7edd32

Please sign in to comment.