Commit graph

4 commits

Author SHA1 Message Date
335b27b72d
Wrap: word wrap and ellipsis over a measure function
Crafter.Graphics shapes one line at a time and drops newlines, so the app
breaks text itself: a greedy wrap with breaks after spaces and hyphens
(a space that itself overflows ends the line after the words that fit,
and opens no line of its own when it ends the text or a newline
follows; one at a line's start is no break at all, nor is a run of
them: a break is recorded only once the line holds a word, and a run of
spaces wider than the line splits like a word, with the same rule at the
text's end and before a newline), hard breaks at
newlines, over-long words split between code points, and
the run of spaces where a line wraps left out of both lines. Results are
cached per (text, width, size). The measure is a function, so the caller
supplies the advances; the tests use a constant ten-pixel advance.

Tested: tests/Wrap on a ten-pixel monospace measure, a leading run of
spaces among the cases.
2026-11-17 06:14:18 +01:00
2a833b0bad
Time: ISO 8601 stamps, civil dates and the captions
imsd renders the service centre's time stamp of a text as ISO 8601 with
the centre's offset and adds the arrival epoch; the captions need the
user's local day and clock. The parser is hand-rolled, with the
calendar's own check of the date (a 30th of February is no date); the
civil dates, the weekdays and the month names are std::chrono's calendar
and its formatting; every caption takes the local offset of the instant
as an argument, so nothing here depends on a time zone database and the
tests inject the offsets.

Tested: tests/Time, the KPN bench stamp in five spellings, rejected
garbage and days the month does not have, the day and list captions
around midnight and across a year.
2026-11-17 06:14:18 +01:00
692f550e31
Number: the conversation key of an address
An address becomes one conversation key. A number in international form
becomes E.164, and one in national form gets the given country code in
front — nine digits or more with a leading 0, or eight or more without
one, as a plan without a trunk prefix writes its numbers, the latter
only while the result is no longer than a number can be; the country
code of an E.164 number is found by the ITU length rule; short codes and
alphanumeric senders are their own keys. The display form puts a space
after the country code.

The key groups; a text goes to the address as dialled (DialledNumber:
the separators gone, a parenthesised trunk zero after a country code
dropped — not after Italy's code or San Marino's, where no zero is a
trunk prefix (a landline's is part of its number, a mobile has none):
such an address names two numbers and is none — nothing added), since
imsd sends a national number or a short code with the type unknown and
the network reads it by its own dialling plan — a country code completed
for the key would be dialled for real. A national number's leading 0 is
taken for the trunk prefix and goes when the country code is added — not
under Italy's code or San Marino's, where it is the number's and stays.
The key's known limits are of grouping: a number written with its
country code and no '+' is completed as a national one, one of a plan
whose trunk prefix is not a lone 0 (Hungary's 06, Russia's 8) is
completed wrongly, and a national number shorter than those lengths
(Iceland's seven digits) stays its digits.

Tested: tests/Number, thirty-two normalisation cases (the parenthesised
trunk zero of an international number, one after San Marino's code left
as no number, a national number's zero kept under Italy's code and San
Marino's, the numbers without a trunk prefix and both rules' shortest
numbers among them), twelve dialled forms (two with a zero in
parentheses after Italy's code, left as typed, among them), the country
codes of one-, two- and three-digit countries, the display forms.
2026-11-17 06:14:18 +01:00
3d635a6f9d
project: the repository skeleton
The SMS app for imsd's net.catcrafts.IMS1.Messaging interface starts
here: the licence (GPL-3.0-only), FUNDING.yml, README and AGENTS, a
project.cpp with the three build products (imsd-messages-core: std and
Crafter.DB; imsd-messages-bus: GLib; the imsd-messages executable),
their module units as stubs, the version constant, the bundled Noto Sans
font with its OFL text, and the first test. This commit is the base every
later range is reviewed against.

Tested: crafter-build builds the three products and --version answers,
crafter-build test passes the one test, lint and format --check are clean
on every text rule and on the AST rules for the eleven files without a
global module fragment; the four files that include gio/gio.h are not
parsed by the lint driver's libclang (no C++ standard library on its
include path: 'type_traits' file not found), which is a Crafter.Build
matter.
2026-10-17 23:14:00 +02:00