Release v2.2.2: Fix Fedora 41 ReportLab ps2tt('dejavu-bold') font family mapping and add bundled Vera.ttf fallback + PLAN-COMPREHENSIVE-MCP-AND-CHATBOT-REST-API-CAPABILITY-EXPOSURE
This commit is contained in:
1 parent
2a882853a9
commit
b465312e3d
41 files changed
+196
-153
No files matched your search
@@ -1,3 +1,3 @@
|
||||
"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.2.1)."""
|
||||
__version__ = "2.2.1"
|
||||
"""hyperstitionstud_io — Shared Common Library for the hyperstitionstud.io workspace (v2.2.2)."""
|
||||
__version__ = "2.2.2"
|
||||
NAMESPACE_URN = "urn:io:hyperstitionstud"
|
||||
@@ -35,8 +35,8 @@ from hyperstitionstud_io.mcp.tools import MCP_TOOLS_SCHEMA, call_mcp_tool # noq
|
||||
|
||||
SERVER_INFO = {
|
||||
"name": "hyperstitionstudio-mcp",
|
||||
"version": "2.2.1",
|
||||
"namespace_urn": "urn:io:hyperstitionstud:mcp:2.2.1",
|
||||
"version": "2.2.2",
|
||||
"namespace_urn": "urn:io:hyperstitionstud:mcp:2.2.2",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -22,17 +22,47 @@ FONT_SEARCH_DIRS = [
|
||||
]
|
||||
|
||||
|
||||
def _reportlab_vera_fallback(filename: str) -> Path | None:
|
||||
try:
|
||||
import reportlab
|
||||
|
||||
rl_fonts = Path(reportlab.__file__).resolve().parent / "fonts"
|
||||
low = filename.lower()
|
||||
if "bold" in low and ("oblique" in low or "italic" in low):
|
||||
cand = rl_fonts / "VeraBI.ttf"
|
||||
elif "bold" in low:
|
||||
cand = rl_fonts / "VeraBd.ttf"
|
||||
elif "oblique" in low or "italic" in low:
|
||||
cand = rl_fonts / "VeraIt.ttf"
|
||||
else:
|
||||
cand = rl_fonts / "Vera.ttf"
|
||||
if cand.is_file():
|
||||
return cand
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
|
||||
def resolve_font_path(filename: str, fallback_filename: str | None = None) -> Path | None:
|
||||
for d in FONT_SEARCH_DIRS:
|
||||
cand = d / filename
|
||||
if cand.is_file():
|
||||
return cand
|
||||
sys_fonts = Path("/usr/share/fonts")
|
||||
if sys_fonts.is_dir():
|
||||
for match in sys_fonts.rglob(filename):
|
||||
if match.is_file():
|
||||
return match
|
||||
if fallback_filename:
|
||||
for d in FONT_SEARCH_DIRS:
|
||||
cand = d / fallback_filename
|
||||
if cand.is_file():
|
||||
return cand
|
||||
return None
|
||||
if sys_fonts.is_dir():
|
||||
for match in sys_fonts.rglob(fallback_filename):
|
||||
if match.is_file():
|
||||
return match
|
||||
return _reportlab_vera_fallback(filename)
|
||||
|
||||
|
||||
def load_pillow_font(filename: str, size: int) -> Any:
|
||||
|
||||
@@ -297,24 +297,25 @@ def compile_markdown_to_pdf(
|
||||
from hyperstitionstud_io.publishing.fonts import resolve_font_path
|
||||
|
||||
f_reg = resolve_font_path("DejaVuSans.ttf")
|
||||
f_bold = resolve_font_path("DejaVuSans-Bold.ttf")
|
||||
f_ob = resolve_font_path("DejaVuSans-Oblique.ttf", fallback_filename="DejaVuSans.ttf")
|
||||
f_bob = resolve_font_path("DejaVuSans-BoldOblique.ttf", fallback_filename="DejaVuSans-Bold.ttf")
|
||||
f_mreg = resolve_font_path("DejaVuSansMono.ttf")
|
||||
f_mbold = resolve_font_path("DejaVuSansMono-Bold.ttf")
|
||||
f_bold = resolve_font_path("DejaVuSans-Bold.ttf", fallback_filename="DejaVuSans.ttf") or f_reg
|
||||
f_ob = resolve_font_path("DejaVuSans-Oblique.ttf", fallback_filename="DejaVuSans.ttf") or f_reg
|
||||
f_bob = resolve_font_path("DejaVuSans-BoldOblique.ttf", fallback_filename="DejaVuSans-Bold.ttf") or f_bold or f_reg
|
||||
f_mreg = resolve_font_path("DejaVuSansMono.ttf", fallback_filename="DejaVuSans.ttf") or f_reg
|
||||
f_mbold = resolve_font_path("DejaVuSansMono-Bold.ttf", fallback_filename="DejaVuSans-Bold.ttf") or f_mreg or f_bold or f_reg
|
||||
|
||||
sans_cmap: dict[int, Any] | None = None
|
||||
mono_cmap: dict[int, Any] | None = None
|
||||
|
||||
if f_reg and f_bold and f_mreg and f_mbold:
|
||||
if f_reg:
|
||||
from reportlab import rl_config
|
||||
from reportlab.lib.fonts import addMapping
|
||||
|
||||
tt_sans = TTFont("DejaVu", str(f_reg))
|
||||
tt_bold = TTFont("DejaVu-Bold", str(f_bold))
|
||||
tt_bold = TTFont("DejaVu-Bold", str(f_bold or f_reg))
|
||||
tt_ob = TTFont("DejaVu-Oblique", str(f_ob or f_reg))
|
||||
tt_bob = TTFont("DejaVu-BoldOblique", str(f_bob or f_bold))
|
||||
tt_mono = TTFont("DejaVuMono", str(f_mreg))
|
||||
tt_mbold = TTFont("DejaVuMono-Bold", str(f_mbold))
|
||||
tt_bob = TTFont("DejaVu-BoldOblique", str(f_bob or f_bold or f_reg))
|
||||
tt_mono = TTFont("DejaVuMono", str(f_mreg or f_reg))
|
||||
tt_mbold = TTFont("DejaVuMono-Bold", str(f_mbold or f_mreg or f_bold or f_reg))
|
||||
|
||||
sans_cmap = tt_sans.face.charToGlyph
|
||||
mono_cmap = tt_mono.face.charToGlyph
|
||||
@@ -341,6 +342,12 @@ def compile_markdown_to_pdf(
|
||||
italic="DejaVuMono",
|
||||
boldItalic="DejaVuMono-Bold",
|
||||
)
|
||||
addMapping("DejaVu", 0, 0, "DejaVu")
|
||||
addMapping("DejaVu", 1, 0, "DejaVu-Bold")
|
||||
addMapping("DejaVu", 0, 1, "DejaVu-Oblique")
|
||||
addMapping("DejaVu", 1, 1, "DejaVu-BoldOblique")
|
||||
addMapping("DejaVuMono", 0, 0, "DejaVuMono")
|
||||
addMapping("DejaVuMono", 1, 0, "DejaVuMono-Bold")
|
||||
|
||||
# Group 3 Dark-Mode Palette Tokens (#020617 Void, #070d1b Well, #0c1324/#111a2e Zebra, #26344d Border)
|
||||
c_void = colors.HexColor("#020617")
|
||||
|
||||
@@ -678,7 +678,7 @@ def build_financial_quant_harvest(
|
||||
payload: dict[str, Any] = {
|
||||
"$schema": "./schemas/v1/financial-aq-harvest.schema.json",
|
||||
"$id": "urn:io:hyperstitionstud:schema:v1:financial-aq-harvest",
|
||||
"version": "2.2.1",
|
||||
"version": "2.2.2",
|
||||
"target_date_utc": datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d"),
|
||||
"harvest_mode": harvest_mode,
|
||||
"synthetic_data_eliminated": True,
|
||||
|
||||
Reference in new issue
Block a user