← Back to Horatio

Content Pack Format

The .htx format the Horatio app reads today (HTX2, format version 2.0), for pack authors

Overview

A Horatio content pack is one binary file with the .htx extension. It starts with the four bytes HTX2 and holds every text of the pack, its manifest and the keys the app uses to find each text. Format version 2.0 replaced the old ZIP layout (manifest.json, codes_map.json, texts/, RPL/): the app no longer reads ZIP packs.

Texts are written in BMD markup. The app reads and checks the whole pack when it installs it, and works offline from then on. A pack holds texts in one language.

Who this page is for

Authors who build a pack for their own use or want to propose one. The app reads only what this page describes: anything else in a pack is ignored, and a pack that breaks a rule here is refused.

File layout

A pack is a fixed 50-byte header followed by the payload. All integers are little-endian.

offset  size  field
     0     4  MAGIC            "HTX2"
     4     2  VERSION          uint16 LE, 0x0200
     6     2  FLAGS            uint16 LE
     8     2  LANG             ASCII, e.g. "la", "en"
    10     8  TIMESTAMP        int64 LE, Unix seconds
    18    16  MANIFEST_DIGEST  BLAKE3, first 16 bytes
    34     4  PAYLOAD_SIZE     uint32 LE
    38    12  RESERVED         zero
    50     -  PAYLOAD          records
FieldMeaning
MAGICAlways HTX2; any other file is refused.
VERSION0x0200. The app accepts 0x0200 to 0x02FF.
FLAGSBit 0: compression (0 = deflate, 1 = zstd). Bit 1: DAY records present. Bit 2: META present, always set. Bit 3: a zstd dictionary is named in META. All other bits 0.
LANGTwo-letter language code, padded with zero bytes.
MANIFEST_DIGESTThe first 16 bytes of the BLAKE3 hash of the uncompressed payload. The app checks it on every install.
PAYLOAD_SIZELength of the uncompressed payload in bytes.

Compress the whole payload with raw deflate (no zlib header, level 9). A zstd pack needs a compression dictionary shipped with the app, so packs built outside PineSoft use deflate.

The app refuses a file larger than 128 MiB.

Records

The payload is a stream of records. Each record starts with a one-byte tag. Strings are UTF-8 with a 32-bit length in front and no terminator.

META  0x00  [u8 tag] [u32 len] [JSON, UTF-8]
BLOB  0x01  [u8 tag] [u32 len] [text, UTF-8]
FRAG  0x02  [u8 tag] [u32 key_len] [key, UTF-8] [u32 blob_index]
DAY   0x03  reserved
RecordMeaning
METAJSON object with the build data and the pack manifest. Exactly one, the first record of the payload.
BLOBOne distinct text. BLOBs are numbered in the order they are written: the first one is 0.
FRAGA fragment key and the number of the BLOB that holds its text. Several keys can point to the same BLOB, so an identical text is stored once.
DAYReserved for precomputed days. Current packs do not write it; leave flag bit 1 at 0.

Order: META, then all BLOBs, then all FRAGs sorted by key. Besides the manifest, META carries the build data below. fragment_count is the number of FRAG records, unique_text_count and text_count the number of BLOB records: the app checks them against the records.

{
  "schema": "horatio.pack.v2",
  "builder": "my-builder 1.0",
  "source_commit": "unknown",
  "corpus_blake3": "0f1e2d3c4b5a69788796a5b4c3d2e1f0",
  "fragment_count": 150,
  "unique_text_count": 150,
  "text_count": 150,
  "languages": ["la"],
  "zstd_dict": null,
  "manifest": { ... }
}

Manifest

The manifest is the manifest object inside META. There is no separate manifest.json file.

"manifest": {
  "id": "my-psalter-la",
  "version": "1.0.0",
  "name": "My Psalter",
  "description": "Psalter for personal use",
  "language": "lat",
  "script": "latin",
  "text_direction": "ltr",
  "required_fonts": [],
  "requires_app_version": "0.3.0",
  "algorithms": [
    { "name": "psalm_doxology", "version": 1, "params": { "rule": "by_slot" } }
  ]
}
FieldMeaning
idRequired. A letter or digit, then letters, digits, ., _ or -, at most 64 characters. A file with the id of an installed pack updates that pack.
nameRequired. The name the pack manager shows. A pack without id or name is refused.
versionPack version in SemVer form (1.0.0). Raise it with every published change.
descriptionShort description shown with the pack.
languageLanguage of the text: 2 or 3 letters (ISO 639), optional subtags such as zh-Hans. Any other form is refused.
scriptWriting system: latin (default), greek, cyrillic, georgian, arabic, hebrew and others.
text_directionltr (default) or rtl.
required_fontsFonts the text needs.
requires_app_versionThe lowest Horatio version that renders this pack's text. Every install path refuses the pack on an older app. Leave it out when any version will do.
algorithmsAlgorithms the pack requires or offers: see Declared algorithms.
min_app_versionKept for compatibility and not checked: use requires_app_version.

These fields are optional descriptive metadata. The app keeps them; they do not change how the text is read or shown:

author, period, genre, difficulty, fragment_count, has_translations, has_morphology, has_audio, pack_size_bytes, checksum_blake3, preservation_status, community_contact, source_institution, source, missal_editions, external_ids, dublin_core

Fragment keys

The app finds each text by its key: parts written as Latin codes and separated by /. A ; in a key is read as /. A pack that serves the calendar must use the keys the app asks for.

KeyMeaning
BIB/GEN/001A Bible chapter: book code, then the chapter with three digits.
PAS/ST02/2FER/L-ANT1A text of the Liturgy of the Hours: season, week, day, then hour and part (here Easter, week 2, Monday, Lauds, first antiphon).
0117A celebration on a fixed date, as month and day (MMDD).

Weekdays use Latin codes with the number first: 1DOM 2FER 3FER 4FER 5FER 6FER 7SAB

Fragment text

A BLOB holds the text of a fragment in BMD markup, optionally preceded by a front matter block between two --- lines. The app reads the BMD when it shows the text.

---
title: Psalm 1
work: Psalter
source_quality: humanTranslation
provenance: ed1
---
# Psalm 1
{Ant.} Antiphon text.
First half of the verse *
  second half of the verse.
{Gloria}
KeyMeaning
titleTitle to show. A title equal to the fragment's own key is not shown.
workWork or collection the text belongs to.
language, scriptLanguage and script of this fragment, when they differ from the pack.
source_qualityHow this text was produced: see Text quality and sources.
provenanceKey of the source this text comes from: see Text quality and sources.

BMD markup

MarkupMeaning
# ## ### Headings, levels 1 to 3.
{text}Rubric, shown in red.
{V.} {R.} {Ant.}Versicle, response and antiphon labels.
text * text + {*} {+}Pause marks of a psalm verse: * at the end of a line, + shown as a dagger; {*} and {+} inside a line.
//text// $text$ ^text^Italic, bold, superscript reference.
{Ant|} {|Ant}Antiphon block.
{Rsp|} {|Rsp} {R*}Responsory block; {R*} marks the part that is repeated.
{Gloria} {!Gloria}Insert the doxology here, or leave it out after this text.
{Int|} {|Int} {C.} {A.} {P.}Intercessions with leader, assembly and petition parts.
{Ref ...}Biblical reference.
{Hour| name} {|Hour} {Sect| name}A whole hour and its sections.
@MEMORIA@Replaced, when the text is shown, by the name of the day's celebration.

Declared algorithms

In algorithms a pack declares behaviour that the app implements and the pack switches on or fills with its own words. Each entry has a name, an integer version (1 when absent) and free-form params. The app applies the names and versions it implements and ignores the others, so an older app still opens the pack. Parameters are written in the language of the pack's text.

NameVersionMeaning
page_labels1params.roles and params.titles: the words of a page that are not pack text (part names, titles), so the page speaks the language of its text.
antiphon_labels1params: the antiphon labels in the pack's language.
celebration_titles1params.titles and params.quality: names of celebrations the app lacks in the pack's language.
source_provenance1params.sources: for each provenance key, a short badge label and the full name of the source.
psalm_doxology1params.rule = by_slot: the app adds the doxology after each psalm and canticle unless the text carries {!Gloria}.
hours_frame1Every hour opens with the initial invocation and ends with its conclusion; Lauds and Vespers carry the Lord's Prayer.
laudes_with_readings1Lauds together with the Invitatory and the readings of the Office of Readings.
laudes_gospel1The combined Lauds may carry the Gospel from the lectionary pack; only next to laudes_with_readings.
gospel_population1params.keys: the Gospel keys a random Gospel is drawn from.
compline_marian_antiphon1params.options and params.seasons: the Marian antiphon of each season at Compline, with the others to choose from.
compline_examination1params.formulas and params.absolution: the extended examination of conscience at Compline.

Text quality and sources

A fragment declares in its front matter how its text was produced, with source_quality. The app shows a badge next to machine-translated text.

ValueMeaning
originalText from the original source.
humanTranslationTranslated by a person.
machineTranslationMachine translation.
verifiedTranslationMachine translation checked by a person.
missingNo text: the app shows a notice that the text is missing.

A fragment without a value, or with an unknown one, takes the pack's value; for a pack the app does not know, that is original.

provenance names the source of a fragment. The pack declares a label and a name for each key with source_provenance, and the app shows a source badge beside the heading. An undeclared key shows nothing: the app never names a source by itself.

Installing and updating

A pack reaches the app in three ways: chosen with the import button of the pack manager, shared to Horatio from another app (files, messaging, cloud storage), or copied into the app's sideload folder, which the app scans at start:

Android/data/com.pinesoft.horatio/files/sideload/

Checklist

Proposing a pack

We welcome texts in rare and endangered languages. To discuss including a pack in Horatio's catalog, write to support@pinesoft.dev