mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-07-23 19:20:41 +02:00
* Lots of work with fonts: Support mappings of various cterm/SyncTERM fonts.
* Load font info from SAUCE * Better work with defaults & theme values
This commit is contained in:
parent
586f3d60b3
commit
5faa11664b
15 changed files with 233 additions and 39 deletions
30
core/art.js
30
core/art.js
|
@ -189,6 +189,12 @@ function parseCharacterSAUCE(sauce) {
|
|||
return result;
|
||||
}
|
||||
|
||||
function getFontNameFromSAUCE(sauce) {
|
||||
if(sauce.Character) {
|
||||
return sauce.Character.fontName;
|
||||
}
|
||||
}
|
||||
|
||||
function sliceAtEOF(data, eofMarker) {
|
||||
var eof = data.length;
|
||||
// :TODO: max scan back or other beter way of doing this?!
|
||||
|
@ -213,7 +219,7 @@ function getArtFromPath(path, options, cb) {
|
|||
//
|
||||
var ext = paths.extname(path).toLowerCase();
|
||||
var encoding = options.encodedAs || defaultEncodingFromExtension(ext);
|
||||
|
||||
|
||||
// :TODO: how are BOM's currently handled if present? Are they removed? Do we need to?
|
||||
|
||||
function sliceOfData() {
|
||||
|
@ -248,12 +254,14 @@ function getArtFromPath(path, options, cb) {
|
|||
// the information provided by SAUCE, use that.
|
||||
//
|
||||
if(!options.encodedAs) {
|
||||
/*
|
||||
if(sauce.Character && sauce.Character.fontName) {
|
||||
var enc = SAUCE_FONT_TO_ENCODING_HINT[sauce.Character.fontName];
|
||||
if(enc) {
|
||||
encoding = enc;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
cb(null, getResult(sauce));
|
||||
}
|
||||
|
@ -469,6 +477,26 @@ function display(options, cb) {
|
|||
}
|
||||
});
|
||||
|
||||
// :TODO: If options.font, set the font via ANSI
|
||||
// ...this should come from sauce, be passed in, or defaulted
|
||||
|
||||
var ansiFont = '';
|
||||
if(options.font) {
|
||||
// :TODO: how to set to ignore SAUCE?
|
||||
ansiFont = ansi.setFont(options.font);
|
||||
} else if(options.sauce) {
|
||||
var fontName = getFontNameFromSAUCE(options.sauce);
|
||||
|
||||
if(fontName) {
|
||||
ansiFont = ansi.setFont(fontName);
|
||||
}
|
||||
}
|
||||
|
||||
if(ansiFont.length > 1) {
|
||||
options.client.term.write(ansiFont);
|
||||
}
|
||||
|
||||
|
||||
if(iceColors) {
|
||||
options.client.term.write(ansi.blinkToBrightIntensity());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue