The font collection code was somewhat wrong in kmc-keyboard-info. It
collected all fonts referenced in the package, even for multi-keyboard
packages, which meant that the .keyboard_info file listed all fonts for
all languages. Furthermore, if a font was referenced in multiple
language entries in the .kps, then it would be repeated for each
language in the .keyboard_info. This patch addresses both of these bugs.
The good news is that this makes some of the .keyboard_info files
smaller. In particular, fv_all.keyboard_info goes from 4675 lines down
to 695 lines!
Fixes: #12852
Cherry-pick-of: #12909
Validation of vars was not properly checking for forward references to
string variables. This, coupled with a null vs undefined bug in
subsequent use, meant that forward reference variables were ending up
with a literal string value of 'undefined'.
This also fixes the test for visual-keyboard-compiler, where the fixture
was actually buggy and was the trigger for investigating this problem.
Fixes: #12403
Relates-to: #12395
The visual keyboard compiler was never finished in 17.0. This rewrites
it to:
1. Use the kmxplus data rather than reading from xml directly
2. Fill in `visualkeyboard.header.kbdname`
3. Support modifiers
4. Handle encoded characters like `\u{1234}`
5. Handle string variables like `${one}`*
Additional unit tests have been added to verify the behavior of the
visual keyboard compiler in more detail.
* String variable tests will be enabled in next commit (which is a
cherry-pick of #12404).
Other fixes:
1. The LDML XML reader was relying on its input being a Node.js `Buffer`
even though it was declared `Uint8Array`, as it implicitly used
`Buffer.toString()` to do text conversion. (`Buffer` subclasses from
`Uint8Array`). This breaks when using `Uint8Array` directly and means
we had an implicit dependency on Node.js. See also #12331.
2. XML errors were not captured in the LDML XML reader. See also #12331.
3. The unused and unfinished touch-layout-compiler.ts and
keymanweb-compiler.ts have been removed along with corresponding unit
tests and fixtures. These will be replaced by Core implementations;
see #12291.
Fixes: #12395
Cherry-pick-of: #12402
Emscripten 3.1.60 made a breaking change to `BindingType::toWireType`
(why is this done in a patch version?) so this change ensures that we
can continue to build on 3.1.58 and 3.1.64 (which is needed for #12234),
as a bridging strategy. We will need to merge this into 17.0-stable as
well so that we can upgrade the build agents to 3.1.64.
Relates-to: emscripten-core/emscripten#21692
Relates-to: #12234
The Description field should be required for published keyboards and
models, so this change means kmc-keyboard-info and kmc-model-info will
report an error if it is missing.
Relates-to: keymanapp/keyboards#3037
Relates-to: keymanapp/lexical-models#262
Fixes: #12202
The Windows Clipboard Win+V key event emits Ctrl+V after rewriting the
clipboard, in order to trigger a Paste action in the active app.
However, the Ctrl key event has been given a scan code value of zero by
Windows Clipboard, which was confusing the Keyman Developer Debugger,
causing it to process Ctrl as an unrecognized key rather than as a
modifier, and leading to an unsupported state.
This is a fix for the immediate issue. We could do more to improve
resilience such that `km_core_state_debug_items()` can never end up with
this exception when `km_core_process_event()` has returned true.
Fixes: #11978
Fixes: KEYMAN-DEVELOPER-20W
This updates the calculation of the lastModifiedDate property of the
.keyboard_info and .model_info file. It now looks for the most recent
commit to HISTORY.md, and then falls back to the project folder for
.keyboard_info and .model_info.
getLastGitCommitDate now also returns UTC date (it was giving TZ=0
which is affected by daylight saving), and works for a file rather than
just for a folder, and a corresponding unit test has been added.
The date strings returned will now always include '.000' msec suffix. I
have manually verified that the import into the api.keyman.com database
copes with this, and that this change still conforms to the expected
schema for .keyboard_info and .model_info files.
Last, but important, it turned out that the unit tests for kmc were not
running. This has been resolved in kmc/build.sh.
Fixes: #11793
Cherry-pick-of: #11805
Currently, keys must be a UTF-16 code unit or a virtual key. Non-BMP
characters are unsupported. Technically, there is space available in the
.kmx `COMP_KEY` structure to accommodate UTF-32 codepoints, from
kmx_file.h:
KMX_WORD_unaligned Key;
KMX_WORD_unaligned _reserved;
However, the utility of this is almost nil, as it is very unlikely we
will encounter base keyboards (for mnemonic layouts) that generate any
characters outside the BMP, so there is little value in adding support
for this at this time.
The compiler will generate an error if this is encountered.
Fixes: #11643
Cherry-pick-of: #11806
The keyboard editor has a complex edit state machine, which has
grown a lot over time. This is a minimal patch to address one specific
edge case scenario on that state machine, without any attempt to improve
the state machine overall. The biggest change here is bubbling failure
up to the main form so that it can destroy (aka Release, which is an
asynchronous destroy) the editor window if it fails to load completely.
Fixes: #11715
Fixes: KEYMAN-DEVELOPER-1JC
I have not been able to reproduce this problem, so adding some extra
debug logs in an attempt to determine what is causing the assertion
failure.
Relates to: #11706
Cherry-pick-of: #11707
The ttfmeta library is extremely rudimentary. It does next to no error
checking, and supports only a small part of the TTF spec. It did not
support NAME platforms 0 or 3 (the most common platform, Windows), and
these are encoded in UTF-16BE. This patch adds support for those
platforms and throws if an unsupported platform/encoding is encountered.
Now, the ttfmeta library is unsupported and gone (#11630). It is based
on another library, ttfinfo, last updated 11 years ago. This is not
great. But the other Node libraries that I located introduce further
dependencies or complex builds (e.g. WASM) and that's not great either,
for a function used only in one place in our build environment.
https://learn.microsoft.com/en-us/typography/opentype/spec/name
The test-font-family.ts runs a basic test against Lateef font, and has
a skipped test that can be run (with minor edits) against all fonts in
the keyboard repository. I have done this to verify that there are no
fonts that return errors, but have disabled this test for deployment for
now.
Fixes: #11625
Remove ttfmeta from package.json, and copy only the relevant files into
ttfmeta/ under kmc-keyboard-info. This is a stopgap measure as we will
probably attempt to identify an alternate library in the future.
See also #11625 which is the driver for making this change now.
Fixes: #11630