Immich theming: Overpass font, anti-aliased white icon
- all text renders in the bundled Overpass SemiBold (Immich's typeface) via vita2d's FreeType path, with a per-pixel-size font instance cache (vita2d's glyph atlas caches glyphs at their first drawn size, which rendered stray oversized letters when sizes mixed) and a system-PGF fallback if the TTF fails to load; the OFL license ships in the vpk next to the font - freetype's bzip2 references get failing stubs (the SDK ships no libbz2 and plain TTFs never hit that path) - icon rebuilt from the official high-res Immich logo: anti-aliased, flattened onto white so the LiveArea no longer shows it on black Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -53,4 +53,6 @@ vita_create_vpk(${PROJECT_NAME}.vpk ${VITA_TITLEID} ${PROJECT_NAME}.self
|
||||
VERSION ${VITA_VERSION}
|
||||
NAME ${VITA_APP_NAME}
|
||||
FILE ${CMAKE_SOURCE_DIR}/assets/sce_sys/icon0.png sce_sys/icon0.png
|
||||
FILE ${CMAKE_SOURCE_DIR}/assets/Overpass-SemiBold.ttf font.ttf
|
||||
FILE ${CMAKE_SOURCE_DIR}/assets/OFL-Overpass.txt OFL-Overpass.txt
|
||||
)
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
Copyright 2021 The Overpass Project Authors (https://github.com/RedHatOfficial/Overpass)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 7.4 KiB |
+82
-19
@@ -83,7 +83,18 @@ static char g_syncdirs[8][192];
|
||||
static int g_syncdir_count;
|
||||
static long g_syncmax_mb = 512;
|
||||
|
||||
static vita2d_pgf *g_font;
|
||||
/* vitasdk's freetype is built with bzip2 support but the SDK ships no
|
||||
* libbz2; we never load bzip2-compressed fonts, so failing stubs satisfy
|
||||
* the linker */
|
||||
int BZ2_bzDecompressInit(void *strm, int verbosity, int small);
|
||||
int BZ2_bzDecompress(void *strm);
|
||||
int BZ2_bzDecompressEnd(void *strm);
|
||||
int BZ2_bzDecompressInit(void *strm, int verbosity, int small) { return -1; }
|
||||
int BZ2_bzDecompress(void *strm) { return -1; }
|
||||
int BZ2_bzDecompressEnd(void *strm) { return -1; }
|
||||
|
||||
static vita2d_pgf *g_font; /* system font, fallback */
|
||||
static vita2d_font *g_ttf; /* bundled Overpass (Immich's face) */
|
||||
|
||||
/* server-asset arrays. dynamically grown (doubling) as pages are fetched, so
|
||||
* the library is bounded only by memory, not a fixed cap. grown on the main
|
||||
@@ -296,10 +307,59 @@ static void log_line(const char *fmt, ...)
|
||||
/* drawing helpers */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
/* one Overpass instance per pixel size: vita2d's glyph atlas caches every
|
||||
* glyph at the first size it is drawn at and reuses that bitmap for other
|
||||
* sizes, so mixing sizes in one font renders letters at the wrong size (an
|
||||
* "E" cached at 20 px showing up oversized inside 17 px text). */
|
||||
static vita2d_font *ttf_for(unsigned int px)
|
||||
{
|
||||
static vita2d_font *cache[8];
|
||||
static unsigned int cache_px[8];
|
||||
static int n;
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
if (cache_px[i] == px)
|
||||
return cache[i];
|
||||
if (n < 8) {
|
||||
vita2d_font *f = vita2d_load_font_file("app0:font.ttf");
|
||||
if (f) {
|
||||
cache[n] = f;
|
||||
cache_px[n] = px;
|
||||
n++;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
return g_ttf; /* shared instance, better than nothing */
|
||||
}
|
||||
|
||||
/* text via the bundled Overpass TTF (Immich's typeface), falling back to
|
||||
* the system PGF font if the TTF failed to load. the pgf "scale" the call
|
||||
* sites use maps to a pixel size (1.0 ~ 20 px). */
|
||||
static void draw_text(float x, float y, uint32_t color, float scale,
|
||||
const char *text)
|
||||
{
|
||||
if (g_ttf) {
|
||||
unsigned int px = (unsigned int)(scale * 20.0f + 0.5f);
|
||||
vita2d_font_draw_text(ttf_for(px), (int)x, (int)y, color,
|
||||
px, text);
|
||||
} else {
|
||||
vita2d_pgf_draw_text(g_font, x, y, color, scale, text);
|
||||
}
|
||||
}
|
||||
|
||||
static int text_width(float scale, const char *text)
|
||||
{
|
||||
if (g_ttf) {
|
||||
unsigned int px = (unsigned int)(scale * 20.0f + 0.5f);
|
||||
return vita2d_font_text_width(ttf_for(px), px, text);
|
||||
}
|
||||
return vita2d_pgf_text_width(g_font, scale, text);
|
||||
}
|
||||
|
||||
static void draw_centered(int y, uint32_t color, const char *text)
|
||||
{
|
||||
int w = vita2d_pgf_text_width(g_font, 1.0f, text);
|
||||
vita2d_pgf_draw_text(g_font, (SCREEN_W - w) / 2, y, color, 1.0f, text);
|
||||
int w = text_width(1.0f, text);
|
||||
draw_text((SCREEN_W - w) / 2, y, color, 1.0f, text);
|
||||
}
|
||||
|
||||
static void show_status(const char *fmt, ...)
|
||||
@@ -344,7 +404,7 @@ static void fatal_error(const char *detail, const char *fmt, ...)
|
||||
for (int off = 0; off < len && y < 480; off += chars_per_line, y += 26) {
|
||||
char line[96];
|
||||
snprintf(line, sizeof(line), "%.*s", chars_per_line, detail + off);
|
||||
vita2d_pgf_draw_text(g_font, 40, y, RGBA8(200, 200, 200, 255), 1.0f, line);
|
||||
draw_text(40, y, RGBA8(200, 200, 200, 255), 1.0f, line);
|
||||
}
|
||||
}
|
||||
draw_centered(510, RGBA8(160, 160, 160, 255), "Press START to exit");
|
||||
@@ -1755,7 +1815,7 @@ static void draw_sel_outline(float x, float y, float w, float h)
|
||||
static void draw_hud(const char *text)
|
||||
{
|
||||
vita2d_draw_rectangle(0, SCREEN_H - 32, SCREEN_W, 32, RGBA8(0, 0, 0, 180));
|
||||
vita2d_pgf_draw_text(g_font, 10, SCREEN_H - 9,
|
||||
draw_text(10, SCREEN_H - 9,
|
||||
RGBA8(255, 255, 255, 255), 1.0f, text);
|
||||
}
|
||||
|
||||
@@ -1793,7 +1853,7 @@ static void draw_play_overlay(void)
|
||||
static void draw_error_detail(int idx)
|
||||
{
|
||||
draw_centered(220, RGBA8(255, 80, 80, 255), "Failed to load this photo");
|
||||
vita2d_pgf_draw_text(g_font, 40, 270, RGBA8(200, 200, 200, 255),
|
||||
draw_text(40, 270, RGBA8(200, 200, 200, 255),
|
||||
1.0f, g_asset_ids[idx]);
|
||||
const char *e = g_tex_err[idx];
|
||||
int len = strlen(e), y = 300;
|
||||
@@ -1801,7 +1861,7 @@ static void draw_error_detail(int idx)
|
||||
for (int off = 0; off < len && y < 500; off += per_line, y += 26) {
|
||||
char line[80];
|
||||
snprintf(line, sizeof(line), "%.*s", per_line, e + off);
|
||||
vita2d_pgf_draw_text(g_font, 40, y, RGBA8(200, 200, 200, 255), 1.0f, line);
|
||||
draw_text(40, y, RGBA8(200, 200, 200, 255), 1.0f, line);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3096,6 +3156,7 @@ int main(void)
|
||||
vita2d_init();
|
||||
vita2d_set_clear_color(RGBA8(16, 16, 16, 255));
|
||||
g_font = vita2d_load_default_pgf();
|
||||
g_ttf = vita2d_load_font_file("app0:font.ttf");
|
||||
|
||||
/* analog mode so the left stick reports lx/ly for detail-view panning */
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
||||
@@ -3537,7 +3598,7 @@ int main(void)
|
||||
float hy = g_sect[h].y - scroll;
|
||||
if (hy + HEADER_H < 0 || hy > SCREEN_H)
|
||||
continue;
|
||||
vita2d_pgf_draw_text(g_font, 10, hy + HEADER_H - 12,
|
||||
draw_text(10, hy + HEADER_H - 12,
|
||||
RGBA8(255, 255, 255, 255),
|
||||
1.1f, g_sect[h].label);
|
||||
vita2d_draw_rectangle(10, hy + HEADER_H - 6,
|
||||
@@ -3565,7 +3626,7 @@ int main(void)
|
||||
vita2d_draw_rectangle(bx, by + bh - 26,
|
||||
64, 26,
|
||||
RGBA8(0, 0, 0, 170));
|
||||
vita2d_pgf_draw_text(g_font, bx + 6,
|
||||
draw_text(bx + 6,
|
||||
by + bh - 7,
|
||||
RGBA8(255, 255, 255, 255),
|
||||
0.85f, "VIDEO");
|
||||
@@ -4073,25 +4134,25 @@ pf_skip:
|
||||
"Server assets: %d%s (%d photos, %d videos)",
|
||||
g_asset_count, g_next_page > 0 ? "+" : "",
|
||||
g_asset_count - srv_vid, srv_vid);
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 1.0f, line); y += 30;
|
||||
draw_text(60, y, c, 1.0f, line); y += 30;
|
||||
human_size(loc_bytes, sz1, sizeof(sz1));
|
||||
snprintf(line, sizeof(line),
|
||||
"Local files: %d (%d photos, %d videos) %s",
|
||||
g_local_count, g_local_count - loc_vid, loc_vid, sz1);
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 1.0f, line); y += 30;
|
||||
draw_text(60, y, c, 1.0f, line); y += 30;
|
||||
snprintf(line, sizeof(line),
|
||||
"backed up %d local-only %d queued/uploading %d",
|
||||
backed, local_only, queued);
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 1.0f, line); y += 30;
|
||||
draw_text(60, y, c, 1.0f, line); y += 30;
|
||||
snprintf(line, sizeof(line), "scanning/hashing %d failed %d",
|
||||
pending, failed);
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 1.0f, line); y += 30;
|
||||
draw_text(60, y, c, 1.0f, line); y += 30;
|
||||
human_size(backed_bytes, sz1, sizeof(sz1));
|
||||
human_size(loc_bytes, sz2, sizeof(sz2));
|
||||
snprintf(line, sizeof(line),
|
||||
"Backed up: %d%% of local (%s / %s)",
|
||||
loc_pct, sz1, sz2);
|
||||
vita2d_pgf_draw_text(g_font, 60, y,
|
||||
draw_text(60, y,
|
||||
RGBA8(120, 200, 120, 255), 1.0f, line);
|
||||
y += 38;
|
||||
|
||||
@@ -4107,7 +4168,7 @@ pf_skip:
|
||||
name = g_asset_ids[si->idx];
|
||||
}
|
||||
snprintf(line, sizeof(line), "Selected: %.40s", name);
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 0.95f, line);
|
||||
draw_text(60, y, c, 0.95f, line);
|
||||
y += 26;
|
||||
if (si->src == SRC_LOCAL) {
|
||||
human_size(g_local_size[si->idx], sz1,
|
||||
@@ -4125,7 +4186,7 @@ pf_skip:
|
||||
g_asset_is_video[si->idx] ?
|
||||
"video" : "photo");
|
||||
}
|
||||
vita2d_pgf_draw_text(g_font, 60, y, c, 0.95f, line);
|
||||
draw_text(60, y, c, 0.95f, line);
|
||||
}
|
||||
y += 36;
|
||||
|
||||
@@ -4139,21 +4200,21 @@ pf_skip:
|
||||
snprintf(line, sizeof(line), "%s",
|
||||
g_sync_activity);
|
||||
}
|
||||
vita2d_pgf_draw_text(g_font, 60, y,
|
||||
draw_text(60, y,
|
||||
RGBA8(120, 200, 120, 255),
|
||||
1.0f, line);
|
||||
}
|
||||
y += 44;
|
||||
|
||||
if (g_sync_errn > 0) {
|
||||
vita2d_pgf_draw_text(g_font, 60, y,
|
||||
draw_text(60, y,
|
||||
RGBA8(220, 120, 120, 255),
|
||||
1.0f, "Recent errors:");
|
||||
y += 30;
|
||||
int shown = g_sync_errn < 5 ? g_sync_errn : 5;
|
||||
for (int k = 0; k < shown && y < 480; k++) {
|
||||
int e = (g_sync_errn - shown + k) % 5;
|
||||
vita2d_pgf_draw_text(g_font, 60, y,
|
||||
draw_text(60, y,
|
||||
RGBA8(200, 160, 160, 255),
|
||||
0.9f, g_sync_errlog[e]);
|
||||
y += 26;
|
||||
@@ -4191,6 +4252,8 @@ pf_skip:
|
||||
for (int i = 0; i < g_local_count; i++)
|
||||
if (g_local_thumb[i])
|
||||
vita2d_free_texture(g_local_thumb[i]);
|
||||
if (g_ttf)
|
||||
vita2d_free_font(g_ttf);
|
||||
vita2d_free_pgf(g_font);
|
||||
vita2d_fini();
|
||||
curl_global_cleanup();
|
||||
|
||||
Reference in New Issue
Block a user