forked from Blendman974/faceclaw
Use TTF fonts throughout the UI; also add some more functions to app extension API
This commit is contained in:
1 parent
5abbe2a405
commit
96842ceb23
82 files changed
+2666
-288
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { getDefaultSmallFont, type BdfFont } from "../../graphics/bdffont";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage, type UiFont } from "../../graphics/image";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
import { GESTURE_CLICK, GESTURE_DOUBLE_CLICK, GESTURE_SCROLL } from "../../ui/gestures";
|
||||
import {
|
||||
@@ -285,7 +285,7 @@ export class MediaBrowseLayer implements Layer {
|
||||
}
|
||||
}
|
||||
|
||||
function truncateRight(font: BdfFont, text: string, maxWidth: number): string {
|
||||
function truncateRight(font: UiFont, text: string, maxWidth: number): string {
|
||||
if (font.measureText(text) <= maxWidth) return text;
|
||||
let out = text;
|
||||
while (out.length > 1 && font.measureText(`${out}...`) > maxWidth) {
|
||||
@@ -294,7 +294,7 @@ function truncateRight(font: BdfFont, text: string, maxWidth: number): string {
|
||||
return `${out}...`;
|
||||
}
|
||||
|
||||
function truncateLeft(font: BdfFont, text: string, maxWidth: number): string {
|
||||
function truncateLeft(font: UiFont, text: string, maxWidth: number): string {
|
||||
if (font.measureText(text) <= maxWidth) return text;
|
||||
let out = text;
|
||||
while (out.length > 1 && font.measureText(`...${out}`) > maxWidth) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/bdffont";
|
||||
import { getDefaultMediumFont, getDefaultSmallFont } from "../../graphics/ui-fonts";
|
||||
import { GrayImage } from "../../graphics/image";
|
||||
import { wrapText, truncateText } from "../../graphics/textwrap";
|
||||
import { clamp } from "../../util/numeric-util";
|
||||
|
||||
Reference in new issue
Block a user