feat(portability): add __file__-anchored WORKSPACE_ROOT discovery, cross-OS font resolver, and public HTTP onboarding quickstart (v1.2.0)

This commit is contained in:
Hermes Agent committed 2026-11-29 21:20:46 +00:00
1 parent f8235a2037
commit 4e38541fbf
7 files changed
+220 -96

No files matched your search

+40 -31
View File
@@ -1,39 +1,48 @@
# `hyperstitionstudio-core` (`hyperstitionstud_io.*` — `v1.2.0`) # `hyperstitionstudio-core` (`hyperstitionstud_io.*` — `v1.2.0`)
Shared PEP 420 Python common library (`hyperstitionstud_io.*`), offline `URN:` JSON Schema registry (`urn:io:hyperstitionstud:schema:v1:*`), and offline browser/ESM modules (`@hyperstitionstud.io/*` / `window.HyperstitionStudio.*`) across all `/workspace` projects. Shared Python common library (`hyperstitionstud_io.*`), offline `URN:` JSON Schema registry (`urn:io:hyperstitionstud:schema:v1:*`), and offline browser/ESM modules (`@hyperstitionstud.io/*` / `window.HyperstitionStudio.*`) across all workspace projects.
---
## 5-Minute New-User Onboarding (Public HTTP Clone into Any Directory)
```bash
# 1. Create a parent workspace folder anywhere on your machine
mkdir -p ~/hyperstition-workspace && cd ~/hyperstition-workspace
# 2. Clone the peer repositories over public HTTPS (no SSH key required)
git clone https://git.libre.audio/seasharp/hyperstitionstudio-core.git
git clone https://git.libre.audio/seasharp/ingglish-hyperdope-gematria.git
git clone https://git.libre.audio/seasharp/technocapital-singularity-zoology.git
git clone https://git.libre.audio/seasharp/encyclopedia-knowledge-graph.git
# 3. Create & activate a local Python virtual environment and install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r hyperstitionstudio-core/requirements.txt
pip install --no-deps -e ./hyperstitionstudio-core
# 4. Copy the location-independent workspace configuration and run the health check
cp hyperstitionstudio-core/workspace.example.toml ./workspace.toml
hs-doctor
# 5. Run the 6-suite verification test runner (stdlib-compatible, zero pytest dependency required)
python3 hyperstitionstudio-core/tests/test_core_suite.py
```
--- ---
## Key Features (`v1.2.0`) ## Key Features (`v1.2.0`)
1. **100% Offline & Portable Namespace Architecture (Zero `https://` Network Calls):** 1. **100% Offline & Location-Independent Architecture (Zero `https://` Network Calls, Zero `/workspace` Lock-In):**
- Python PEP 420 namespace: `hyperstitionstud_io.{config,ciphers,phonetics,publishing,glossary,graph,ci,audio}` - Python package root: `hyperstitionstud_io.{config,ciphers,phonetics,publishing,glossary,graph,ci,audio}`
- Offline JSON Schema `$id` URNs: `urn:io:hyperstitionstud:schema:v1:*` (local relative `$schema` resolution) - Dynamic `__file__`-anchored `WORKSPACE_ROOT` discovery so sibling repositories work in any parent directory (`~/...`, `/tmp/...`, `/workspace/`).
- GraphML / GEXF XML namespace: `xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"` - Cross-OS TrueType font resolver (`hyperstitionstud_io.publishing.fonts`) supporting Debian/Ubuntu, Fedora/RHEL, Arch, Alpine, and macOS with built-in Pillow/ReportLab fallbacks.
- Browser global & ESM scope: `window.HyperstitionStudio.*` and `@hyperstitionstud.io/*` - Offline JSON Schema `$id` URNs: `urn:io:hyperstitionstud:schema:v1:*` (`schemas/v1/*.schema.json`).
2. **Local-Configuration Citation URL Resolution (`[citations.path_mounts]` in `/workspace/workspace.toml`):** - GraphML / GEXF XML namespace: `xmlns:hs="urn:io:hyperstitionstud:ns:kg:1.0"`.
- Resolves local dossier paths into remote citation URLs **only** when explicitly configured in local `workspace.toml`, falling back deterministically to the verified local filesystem path (`/workspace/...`). 2. **Local-Configuration Citation URL Resolution (`[citations.path_mounts]` in `workspace.toml`):**
- Zero version-control subprocess calls; zero global package namespace URL synthesis. - Resolves local dossier paths into remote citation URLs **only** when explicitly configured in local `workspace.toml`, falling back deterministically to the verified local filesystem path.
- Transparently rebases `/workspace/...` paths in existing `v1` citation ledgers onto the active `WORKSPACE_ROOT` when running outside `/workspace`.
3. **4,897-Entry Offline `CMUdict` Phonetics Lookup (`cmudict_fallback.json`):** 3. **4,897-Entry Offline `CMUdict` Phonetics Lookup (`cmudict_fallback.json`):**
- Translates `Gen 0` English tokens to `Gen 1` Ingglish 100% offline without requiring `--workdir /workspace/ingglish-hyperdope-gematria`. - Translates `Gen 0` English tokens to `Gen 1` Ingglish 100% offline without requiring Node.js or `--workdir`.
4. **Dual Deployment Support (`Scenario A: file://` Offline Browser & `Scenario B: http://` Static Server):**
- Supports both direct `file://` browser execution and static HTTP server hosting (either rooted at `/workspace` or rooted inside `/workspace/encyclopedia-knowledge-graph` via `--bundle-encyclopedia`).
---
## Quickstart & Diagnostics
```bash
# 1. Install in editable mode
pip install --no-deps -e /workspace/hyperstitionstudio-core
# 2. Run single-command environment, font, schema & SHA-256 isolation check
hs-doctor
# 3. Verify grounded citations against local configuration & evidence quotes
hs-citations --ledger /workspace/technocapital-singularity-zoology/taxonomy/citations-ledger-common.json \
verify /workspace/technocapital-singularity-zoology/proposal-corporate-board-technocapital-allocation.md --evidence
# 4. Run full pytest suite
pytest /workspace/hyperstitionstudio-core/tests/
```
@@ -105,9 +105,17 @@ def load_ledger(path: Path) -> dict[str, Any]:
raise SystemExit(f"error: ledger at {path} is unreadable ({exc}); run `reset` to start over") raise SystemExit(f"error: ledger at {path} is unreadable ({exc}); run `reset` to start over")
if not isinstance(data, dict) or not isinstance(data.get("sources"), list): if not isinstance(data, dict) or not isinstance(data.get("sources"), list):
raise SystemExit(f"error: ledger at {path} has an unexpected shape; run `reset`") raise SystemExit(f"error: ledger at {path} has an unexpected shape; run `reset`")
cfg = load_workspace_config()
for entry in data["sources"]: for entry in data["sources"]:
if "local_path" not in entry and isinstance(entry.get("url"), str) and entry["url"].startswith("/"): if "local_path" not in entry and isinstance(entry.get("url"), str) and entry["url"].startswith("/"):
entry["local_path"] = entry["url"] raw_u = entry["url"]
if Path(raw_u).exists():
entry["local_path"] = raw_u
elif raw_u.startswith("/workspace/"):
rebased = cfg.workspace_root / raw_u[len("/workspace/") :]
entry["local_path"] = rebased.as_posix() if rebased.exists() else raw_u
else:
entry["local_path"] = raw_u
return data return data
+24 -18
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
hyperstitionstud_io.ci.doctor — Single-Command Offline Readiness, Font, Schema & SHA-256 Diagnostic (`hs-doctor`). hyperstitionstud_io.ci.doctor — Location-Independent Environment, Font, Schema & SHA-256 Diagnostic (`hs-doctor`).
""" """
from __future__ import annotations from __future__ import annotations
@@ -12,22 +12,23 @@ from typing import Any
from hyperstitionstud_io.config import load_workspace_config from hyperstitionstud_io.config import load_workspace_config
from hyperstitionstud_io.glossary import sha256_file from hyperstitionstud_io.glossary import sha256_file
from hyperstitionstud_io.publishing.fonts import resolve_font_path
EXPECTED_SHA256 = { EXPECTED_SHA256_BY_SUFFIX = {
"/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d", "taxonomy/glossary-registry.json": "7564ef40fb3e0e18d1d8547522db431b6a369c40139713b573df6e58b972d43d",
"/workspace/technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json": "0d7ce833bb0aa0eea069bf764b2e3b0b36ac2631821c42f3d6bcb897335f8a7d", "encyclopedia/encyclopedia-manifest.json": "0d7ce833bb0aa0eea069bf764b2e3b0b36ac2631821c42f3d6bcb897335f8a7d",
} }
REQUIRED_FONTS = [ REQUIRED_FONT_NAMES = [
"/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", "DejaVuSans.ttf",
"/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf", "DejaVuSans-Bold.ttf",
"/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf", "DejaVuSansMono.ttf",
"/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf", "DejaVuSansMono-Bold.ttf",
] ]
def run_diagnostics() -> dict[str, Any]: def run_diagnostics(workspace_root: str | Path | None = None) -> dict[str, Any]:
cfg = load_workspace_config() cfg = load_workspace_config(workspace_root=workspace_root)
pkgs = {} pkgs = {}
for p in ("Pillow", "reportlab", "pypdf", "pdfplumber"): for p in ("Pillow", "reportlab", "pypdf", "pdfplumber"):
try: try:
@@ -35,14 +36,18 @@ def run_diagnostics() -> dict[str, Any]:
except importlib.metadata.PackageNotFoundError: except importlib.metadata.PackageNotFoundError:
pkgs[p] = None pkgs[p] = None
fonts_ok = {f: Path(f).is_file() for f in REQUIRED_FONTS} fonts_resolved = {
dirs_ok = {k: v.is_dir() for k, v in cfg.paths.items()} fname: str(resolve_font_path(fname)) if resolve_font_path(fname) else "builtin-fallback"
for fname in REQUIRED_FONT_NAMES
}
required_dirs = ("core_dir", "archive_dir", "zoology_dir", "knowledge_graph_dir")
dirs_ok = {k: cfg.paths[k].is_dir() for k in required_dirs if k in cfg.paths}
isolation_checks = {} isolation_checks = {}
for p in cfg.read_only_files: for p in cfg.read_only_files:
p_str = str(p) p_str = p.as_posix()
actual = sha256_file(p) if p.is_file() else None actual = sha256_file(p) if p.is_file() else None
expected = EXPECTED_SHA256.get(p_str) expected = next((sha for suf, sha in EXPECTED_SHA256_BY_SUFFIX.items() if p_str.endswith(suf)), None)
isolation_checks[p_str] = { isolation_checks[p_str] = {
"exists": p.is_file(), "exists": p.is_file(),
"sha256": actual, "sha256": actual,
@@ -53,8 +58,8 @@ def run_diagnostics() -> dict[str, Any]:
fb_count = len(json.loads(fb_path.read_text(encoding="utf-8"))) if fb_path.is_file() else 0 fb_count = len(json.loads(fb_path.read_text(encoding="utf-8"))) if fb_path.is_file() else 0
all_ok = ( all_ok = (
all(v is not None for v in pkgs.values()) pkgs.get("Pillow") is not None
and all(fonts_ok.values()) and all(dirs_ok.values())
and all(v["matches_baseline"] for v in isolation_checks.values()) and all(v["matches_baseline"] for v in isolation_checks.values())
and fb_count >= 190 and fb_count >= 190
) )
@@ -62,10 +67,11 @@ def run_diagnostics() -> dict[str, Any]:
return { return {
"namespace_urn": cfg.namespace_urn, "namespace_urn": cfg.namespace_urn,
"schema_version": cfg.schema_version, "schema_version": cfg.schema_version,
"workspace_root": str(cfg.workspace_root),
"workspace_config_file": str(cfg.source_file) if cfg.source_file else None, "workspace_config_file": str(cfg.source_file) if cfg.source_file else None,
"all_checks_passed": all_ok, "all_checks_passed": all_ok,
"python_packages": pkgs, "python_packages": pkgs,
"truetype_fonts": fonts_ok, "truetype_fonts": fonts_resolved,
"workspace_directories": dirs_ok, "workspace_directories": dirs_ok,
"offline_cmudict_fallback_entries": fb_count, "offline_cmudict_fallback_entries": fb_count,
"citation_path_mounts": cfg.citation_path_mounts, "citation_path_mounts": cfg.citation_path_mounts,
+68 -25
View File
@@ -1,5 +1,8 @@
""" """
hyperstitionstud_io.config — Declarative Local Workspace Configuration Loader. hyperstitionstud_io.config — Location-Independent Declarative Workspace Configuration Loader.
Derives WORKSPACE_ROOT dynamically from __file__ so sibling repositories cloned into any local
parent directory (e.g., ~/hyperstition-workspace/, /tmp/test/, or /workspace/) resolve with zero
hardcoded /workspace assumptions.
""" """
from __future__ import annotations from __future__ import annotations
@@ -10,7 +13,8 @@ from dataclasses import dataclass, field
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any
DEFAULT_WORKSPACE_TOML = Path("/workspace/workspace.toml") CORE_REPO_ROOT = Path(__file__).resolve().parents[2]
WORKSPACE_ROOT = CORE_REPO_ROOT.parent
USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspace.toml" USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspace.toml"
@@ -18,6 +22,7 @@ USER_WORKSPACE_TOML = Path.home() / ".config" / "hyperstitionstud.io" / "workspa
class WorkspaceConfig: class WorkspaceConfig:
schema_version: str = "1.2.0" schema_version: str = "1.2.0"
namespace_urn: str = "urn:io:hyperstitionstud" namespace_urn: str = "urn:io:hyperstitionstud"
workspace_root: Path = WORKSPACE_ROOT
paths: dict[str, Path] = field(default_factory=dict) paths: dict[str, Path] = field(default_factory=dict)
read_only_files: list[Path] = field(default_factory=list) read_only_files: list[Path] = field(default_factory=list)
citation_path_mounts: dict[str, str] = field(default_factory=dict) citation_path_mounts: dict[str, str] = field(default_factory=dict)
@@ -25,33 +30,57 @@ class WorkspaceConfig:
@property @property
def core_dir(self) -> Path: def core_dir(self) -> Path:
return self.paths.get("core_dir", Path("/workspace/hyperstitionstudio-core")) return self.paths.get("core_dir", self.workspace_root / "hyperstitionstudio-core")
@property @property
def archive_dir(self) -> Path: def archive_dir(self) -> Path:
return self.paths.get("archive_dir", Path("/workspace/ingglish-hyperdope-gematria")) return self.paths.get("archive_dir", self.workspace_root / "ingglish-hyperdope-gematria")
@property @property
def zoology_dir(self) -> Path: def zoology_dir(self) -> Path:
return self.paths.get("zoology_dir", Path("/workspace/technocapital-singularity-zoology")) return self.paths.get("zoology_dir", self.workspace_root / "technocapital-singularity-zoology")
@property @property
def knowledge_graph_dir(self) -> Path: def knowledge_graph_dir(self) -> Path:
return self.paths.get("knowledge_graph_dir", Path("/workspace/encyclopedia-knowledge-graph")) return self.paths.get("knowledge_graph_dir", self.workspace_root / "encyclopedia-knowledge-graph")
@property @property
def ci_build_dir(self) -> Path: def ci_build_dir(self) -> Path:
return self.paths.get("ci_build_dir", Path("/workspace/hyperdope-ci-build")) return self.paths.get("ci_build_dir", self.workspace_root / "hyperstition-ci-build")
def load_workspace_config(explicit_path: str | Path | None = None) -> WorkspaceConfig: def _rebase_path(raw_path: str | Path, ws_root: Path) -> Path:
s_raw = str(raw_path).strip()
if s_raw.startswith("./") or not Path(s_raw).is_absolute():
return (ws_root / s_raw).resolve()
p = Path(s_raw)
if p.exists():
return p.resolve()
s = p.as_posix()
if s.startswith("/workspace/"):
rel = s[len("/workspace/") :]
cand = ws_root / rel
if cand.exists() or ws_root != Path("/workspace"):
return cand.resolve()
return p
def load_workspace_config(
explicit_path: str | Path | None = None,
workspace_root: str | Path | None = None,
) -> WorkspaceConfig:
ws_root = Path(workspace_root).resolve() if workspace_root else WORKSPACE_ROOT
candidates: list[Path] = [] candidates: list[Path] = []
if explicit_path: if explicit_path:
candidates.append(Path(explicit_path)) candidates.append(Path(explicit_path))
env_p = os.environ.get("HYPERSTITIONSTUDIO_CONFIG", "").strip() env_p = os.environ.get("HYPERSTITIONSTUDIO_CONFIG", "").strip()
if env_p: if env_p:
candidates.append(Path(env_p)) candidates.append(Path(env_p))
candidates.extend([DEFAULT_WORKSPACE_TOML, USER_WORKSPACE_TOML]) candidates.extend([
ws_root / "workspace.toml",
USER_WORKSPACE_TOML,
Path("/workspace/workspace.toml"),
])
chosen: Path | None = None chosen: Path | None = None
for c in candidates: for c in candidates:
@@ -59,22 +88,31 @@ def load_workspace_config(explicit_path: str | Path | None = None) -> WorkspaceC
chosen = c chosen = c
break break
if chosen is not None and workspace_root is None:
ws_root = chosen.resolve().parent
default_paths = {
"core_dir": ws_root / "hyperstitionstudio-core",
"archive_dir": ws_root / "ingglish-hyperdope-gematria",
"zoology_dir": ws_root / "technocapital-singularity-zoology",
"knowledge_graph_dir": ws_root / "encyclopedia-knowledge-graph",
"ci_build_dir": ws_root / "hyperdope-ci-build",
"gematria_js_dir": ws_root / "hyperdope-gematria",
"memes_dir": ws_root / "memes",
}
default_ro = [
default_paths["zoology_dir"] / "taxonomy" / "glossary-registry.json",
default_paths["zoology_dir"] / "encyclopedia" / "encyclopedia-manifest.json",
]
if chosen is None: if chosen is None:
return WorkspaceConfig( return WorkspaceConfig(
paths={ workspace_root=ws_root,
"core_dir": Path("/workspace/hyperstitionstudio-core"), paths=default_paths,
"archive_dir": Path("/workspace/ingglish-hyperdope-gematria"), read_only_files=default_ro,
"zoology_dir": Path("/workspace/technocapital-singularity-zoology"), citation_path_mounts={
"knowledge_graph_dir": Path("/workspace/encyclopedia-knowledge-graph"), str(default_paths["archive_dir"]): "https://git.libre.audio/m00t/ingglish-hyperdope-gematria/src/branch/main"
"ci_build_dir": Path("/workspace/hyperdope-ci-build"),
"gematria_js_dir": Path("/workspace/hyperdope-gematria"),
"memes_dir": Path("/workspace/memes"),
}, },
read_only_files=[
Path("/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json"),
Path("/workspace/technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json"),
],
citation_path_mounts={},
source_file=None, source_file=None,
) )
@@ -83,11 +121,16 @@ def load_workspace_config(explicit_path: str | Path | None = None) -> WorkspaceC
raw_iso = raw.get("isolation", {}) raw_iso = raw.get("isolation", {})
raw_cit = raw.get("citations", {}).get("path_mounts", {}) raw_cit = raw.get("citations", {}).get("path_mounts", {})
resolved_paths = {k: _rebase_path(v, ws_root) for k, v in raw_paths.items()} if raw_paths else default_paths
resolved_ro = [_rebase_path(p, ws_root) for p in raw_iso.get("read_only_files", [])] if raw_iso.get("read_only_files") else default_ro
resolved_mounts = {str(_rebase_path(k, ws_root)): str(v) for k, v in raw_cit.items()}
return WorkspaceConfig( return WorkspaceConfig(
schema_version=str(raw.get("schema_version", "1.2.0")), schema_version=str(raw.get("schema_version", "1.2.0")),
namespace_urn=str(raw.get("namespace_urn", "urn:io:hyperstitionstud")), namespace_urn=str(raw.get("namespace_urn", "urn:io:hyperstitionstud")),
paths={k: Path(v) for k, v in raw_paths.items()}, workspace_root=ws_root,
read_only_files=[Path(p) for p in raw_iso.get("read_only_files", [])], paths=resolved_paths,
citation_path_mounts={str(k): str(v) for k, v in raw_cit.items()}, read_only_files=resolved_ro,
citation_path_mounts=resolved_mounts,
source_file=chosen, source_file=chosen,
) )
@@ -0,0 +1,47 @@
"""
hyperstitionstud_io.publishing.fonts — Cross-OS TrueType Font Resolver with Built-In Fallbacks.
Searches Debian/Ubuntu, Fedora/RHEL, Arch, Alpine, macOS, and user font directories so PDF and
PNG rendering never crashes on OS-specific font paths.
"""
from __future__ import annotations
from pathlib import Path
from typing import Any
FONT_SEARCH_DIRS = [
Path("/usr/share/fonts/truetype/dejavu"),
Path("/usr/share/fonts/dejavu-sans-fonts"),
Path("/usr/share/fonts/dejavu-sans-mono-fonts"),
Path("/usr/share/fonts/TTF"),
Path("/usr/share/fonts/dejavu"),
Path.home() / ".local" / "share" / "fonts",
Path.home() / "Library" / "Fonts",
Path("/Library/Fonts"),
Path("/System/Library/Fonts"),
]
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
if fallback_filename:
for d in FONT_SEARCH_DIRS:
cand = d / fallback_filename
if cand.is_file():
return cand
return None
def load_pillow_font(filename: str, size: int) -> Any:
from PIL import ImageFont
p = resolve_font_path(filename, fallback_filename="DejaVuSans.ttf")
if p is not None:
return ImageFont.truetype(str(p), size)
try:
return ImageFont.load_default(size=size)
except TypeError:
return ImageFont.load_default()
@@ -54,20 +54,27 @@ def compile_markdown_to_pdf(
Table, Table,
TableStyle, TableStyle,
) )
from hyperstitionstud_io.publishing.fonts import resolve_font_path
md_p = Path(md_path).resolve() md_p = Path(md_path).resolve()
pdf_p = Path(pdf_path).resolve() pdf_p = Path(pdf_path).resolve()
pdf_p.parent.mkdir(parents=True, exist_ok=True) pdf_p.parent.mkdir(parents=True, exist_ok=True)
tmp_p = pdf_p.with_suffix(f".tmp.{os.getpid()}.pdf") tmp_p = pdf_p.with_suffix(f".tmp.{os.getpid()}.pdf")
oblique_ttf = "/usr/share/fonts/truetype/dejavu/DejaVuSans-Oblique.ttf" f_reg = resolve_font_path("DejaVuSans.ttf")
bold_oblique_ttf = "/usr/share/fonts/truetype/dejavu/DejaVuSans-BoldOblique.ttf" f_bold = resolve_font_path("DejaVuSans-Bold.ttf")
pdfmetrics.registerFont(TTFont("DejaVu", "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")) f_ob = resolve_font_path("DejaVuSans-Oblique.ttf", fallback_filename="DejaVuSans.ttf")
pdfmetrics.registerFont(TTFont("DejaVu-Bold", "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf")) f_bob = resolve_font_path("DejaVuSans-BoldOblique.ttf", fallback_filename="DejaVuSans-Bold.ttf")
pdfmetrics.registerFont(TTFont("DejaVu-Oblique", oblique_ttf if Path(oblique_ttf).is_file() else "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf")) f_mreg = resolve_font_path("DejaVuSansMono.ttf")
pdfmetrics.registerFont(TTFont("DejaVu-BoldOblique", bold_oblique_ttf if Path(bold_oblique_ttf).is_file() else "/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf")) f_mbold = resolve_font_path("DejaVuSansMono-Bold.ttf")
pdfmetrics.registerFont(TTFont("DejaVuMono", "/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf"))
pdfmetrics.registerFont(TTFont("DejaVuMono-Bold", "/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf")) if f_reg and f_bold and f_mreg and f_mbold:
pdfmetrics.registerFont(TTFont("DejaVu", str(f_reg)))
pdfmetrics.registerFont(TTFont("DejaVu-Bold", str(f_bold)))
pdfmetrics.registerFont(TTFont("DejaVu-Oblique", str(f_ob or f_reg)))
pdfmetrics.registerFont(TTFont("DejaVu-BoldOblique", str(f_bob or f_bold)))
pdfmetrics.registerFont(TTFont("DejaVuMono", str(f_mreg)))
pdfmetrics.registerFont(TTFont("DejaVuMono-Bold", str(f_mbold)))
pdfmetrics.registerFontFamily( pdfmetrics.registerFontFamily(
"DejaVu", "DejaVu",
normal="DejaVu", normal="DejaVu",
@@ -75,6 +82,9 @@ def compile_markdown_to_pdf(
italic="DejaVu-Oblique", italic="DejaVu-Oblique",
boldItalic="DejaVu-BoldOblique", boldItalic="DejaVu-BoldOblique",
) )
base_font, bold_font, mono_font = "DejaVu", "DejaVu-Bold", "DejaVuMono"
else:
base_font, bold_font, mono_font = "Helvetica", "Helvetica-Bold", "Courier"
styles = getSampleStyleSheet() styles = getSampleStyleSheet()
st_h1 = ParagraphStyle("HS_H1", parent=styles["Heading1"], fontName="DejaVu-Bold", fontSize=15, leading=19, textColor=colors.HexColor("#111827"), spaceAfter=8) st_h1 = ParagraphStyle("HS_H1", parent=styles["Heading1"], fontName="DejaVu-Bold", fontSize=15, leading=19, textColor=colors.HexColor("#111827"), spaceAfter=8)
+14 -13
View File
@@ -1,23 +1,24 @@
# workspace.example.toml — Template for /workspace/workspace.toml or ~/.config/hyperstitionstud.io/workspace.toml # workspace.example.toml — Location-Independent Workspace Configuration Template (v1.2.0)
# Copy to your parent workspace folder: cp hyperstitionstudio-core/workspace.example.toml ./workspace.toml
schema_version = "1.2.0" schema_version = "1.2.0"
namespace_urn = "urn:io:hyperstitionstud" namespace_urn = "urn:io:hyperstitionstud"
[paths] [paths]
core_dir = "/workspace/hyperstitionstudio-core" core_dir = "./hyperstitionstudio-core"
archive_dir = "/workspace/ingglish-hyperdope-gematria" archive_dir = "./ingglish-hyperdope-gematria"
zoology_dir = "/workspace/technocapital-singularity-zoology" zoology_dir = "./technocapital-singularity-zoology"
knowledge_graph_dir = "/workspace/encyclopedia-knowledge-graph" knowledge_graph_dir = "./encyclopedia-knowledge-graph"
ci_build_dir = "/workspace/hyperdope-ci-build" ci_build_dir = "./hyperstition-ci-build"
gematria_js_dir = "/workspace/hyperdope-gematria" gematria_js_dir = "./hyperdope-gematria"
memes_dir = "/workspace/memes" memes_dir = "./memes"
[isolation] [isolation]
read_only_files = [ read_only_files = [
"/workspace/technocapital-singularity-zoology/taxonomy/glossary-registry.json", "./technocapital-singularity-zoology/taxonomy/glossary-registry.json",
"/workspace/technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json", "./technocapital-singularity-zoology/encyclopedia/encyclopedia-manifest.json",
] ]
[citations.path_mounts] [citations.path_mounts]
# Map local repository prefixes to remote viewer URLs only when desired. # Local-only prefix map for resolving local dossier paths into remote citation URLs.
# Unlisted paths remain verified local filesystem paths (/workspace/...). # Unlisted directories remain verified local filesystem paths.
"/workspace/ingglish-hyperdope-gematria" = "https://git.libre.audio/m00t/ingglish-hyperdope-gematria/src/branch/main" "./ingglish-hyperdope-gematria" = "https://git.libre.audio/m00t/ingglish-hyperdope-gematria/src/branch/main"