Commit graph

3004 commits

Author SHA1 Message Date
Marc Durdin
1e2ad40c19 fix(developer): filter incorrect fonts out of .keyboard_info
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
2025-01-16 15:23:26 +07:00
Marc Durdin
3da2c28956 fix(developer): handle merge commits when checking git log date
Relates-to: keymanapp/keyboards#3143
Fixes: #12626
Fixes: KEYMAN-DEVELOPER-2AY
Cherry-pick-of: #12627
2024-11-06 06:13:17 +07:00
Marc Durdin
3cd28d4f9f fix(developer): create Server config directory before options save
Also use back-off logic for saving in case config file is locked by
another process.

Cherry-pick-of: #12608
Fixes: #12607
Fixes: KEYMAN-DEVELOPER-1Z1
2024-11-04 08:07:07 +07:00
Marc Durdin
2542d62b16
Merge pull request #12523 from keymanapp/fix/developer/cherry-pick/12449-row-keys-whitespace
fix(developer): ignore excess whitespace in `<row keys>` attribute 🏠
2024-10-10 08:55:56 +02:00
Marc Durdin
0c9f272cbc fix(developer): prevent invalid string ids
Adds checks for invalid string IDs and corresponding unit tests.

Fixes: #12451
Cherry-pick-of: #12645
2024-10-10 11:54:45 +07:00
Marc Durdin
df1ec2fe94 fix(developer): ignore excess whitespace in <row keys> attribute
Cherry-pick-of: #12468
Fixes: #12449
2024-10-10 11:49:19 +07:00
Marc Durdin
69a5d9975c
Merge pull request #12407 from keymanapp/fix/developer/cherry-pick/12403-validate-string-use-before-definition
fix(developer): check vars string usage before definition 🍒 🏠
2024-09-17 00:40:42 +02:00
Marc Durdin
94a4ac4eae fix(developer): LDML compiler, add TSS_VISUALKEYBOARD store when compiling visual keyboard
Fixes: #12395
Cherry-pick-of: #12402
2024-09-16 14:31:13 +07:00
Marc Durdin
62af49a46a chore(developer): rename CompilerMessages back for 17.0 2024-09-12 10:24:43 +07:00
Marc Durdin
44e28e21a6 fix(developer): check vars string usage before definition
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
2024-09-12 10:05:13 +07:00
Marc Durdin
91cd73602a fix(developer): rwrite ldml visual keyboard compiler
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
2024-09-12 10:02:18 +07:00
Marc Durdin
6c9b335bc7 fix(developer): find last matching key in LDML key bag when building KVK
Fixes: #12056
Cherry-pick-of: #12278
2024-08-26 10:24:56 +07:00
Marc Durdin
952e7beb57 chore: use emcc not emcc.py on mac/linux
This is a manual cherry-pick of #12235, for 17.0-stable.

Cherry-pick-of: #12235
2024-08-21 16:05:29 +02:00
Marc Durdin
a2344abb64 chore(developer): enable build for emscripten 3.1.60+
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
2024-08-21 15:09:16 +02:00
Marc Durdin
6fe7dfcb03
Merge pull request #12207 from keymanapp/fix/developer/cherry-pick/12202-info-compilers-enforce-description-field
fix(developer): enforce presence of kps Info.Description field in info compilers 🍒 🏠
2024-08-16 23:12:45 +10:00
Marc Durdin
a8e6dc847f chore(developer): rename PackageCompilerMessages references for 17.0 2024-08-16 10:15:20 +02:00
Marc Durdin
2f75bb24db fix(developer): enforce presence of kps Info.Description field in info compilers
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
2024-08-16 08:28:05 +02:00
Marc Durdin
6da1eb1832 fix(developer): enforce presence of Version field when FollowKeyboardVersion is not set, in package compiler
Fixes: #12193
Cherry-pick-of: #12205
2024-08-16 08:26:35 +02:00
Marc Durdin
4c1832d46f fix(developer): ignore scan code if zero in debugger
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
2024-08-14 13:23:35 +02:00
Marc Durdin
4a715446ff
Merge pull request #11807 from keymanapp/fix/developer/cherry-pick/11643-prevent-non-bmp-chars-in-key-part-of-rule
fix(developer): prevent non-BMP characters in key part of rule 🍒 🏠
2024-07-01 11:38:19 +10:00
Marc Durdin
3f585b06d9
Merge pull request #11808 from keymanapp/fix/developer/cherry-pick/11793-use-HISTORY-MD-for-last-commit-date
fix(developer): check HISTORY.md to get last modified date for keyboard_info and model_info 🍒 🏠
2024-06-19 11:30:28 +10:00
Marc Durdin
be65910743 chore(developer): clarify project upgrade messages about file locations
Cherry-pick-of: #11819
2024-06-19 06:26:19 +10:00
Marc Durdin
ebd2a9131f chore(developer): add msec in comment 2024-06-18 07:38:23 +10:00
Marc Durdin
e56472d9b2 fix(developer): check HISTORY.md to get last modified date for keyboard_info and model_info
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
2024-06-18 07:38:04 +10:00
Marc Durdin
fbd90a1a7c test(developer): add fixture for getLastGitCommitDate unit test 2024-06-18 07:37:24 +10:00
Marc Durdin
b0fd228879 fix(developer): prevent non-BMP characters in key part of rule
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
2024-06-18 07:27:25 +10:00
Marc Durdin
a0628177ee
Merge pull request #11766 from keymanapp/fix/developer/cherry-pick/11646-add-platform-no-more-platforms-builder
fix(developer): show message if no more platforms to add to touch layout editor 🍒 🏠
2024-06-15 07:08:24 +10:00
Marc Durdin
a76313d725 fix(developer): show message if no more platforms to add to touch layout editor
Fixes: #11646
Fixes: KEYMAN-DEVELOPER-1X2
2024-06-13 10:01:32 +10:00
Marc Durdin
b99fc3415f feat(developer): support language reference in context help
Adds support for `<LanguageReference Name='keyword'>` in contexthelp.xml.

Cherry-pick-of: #11737
2024-06-08 07:49:00 +07:00
Marc Durdin
f13feaf620
Merge pull request #11727 from keymanapp/fix/developer/cherry-pick/11715-prevent-two-touch-layout-editors-opening-for-same-file
fix(developer): prevent two touch layout editors opening for the same file 🍒 🏠
2024-06-08 10:44:49 +10:00
Marc Durdin
af6b052f14
Merge pull request #11721 from keymanapp/fix/developer/cherry-pick/11719-handle-missing-osk-when-importing-windows-keyboard
fix(developer): handle missing OSK when importing a Windows keyboard into a touch-only project 🍒 🏠
2024-06-08 10:44:40 +10:00
Marc Durdin
80274ce537
Merge pull request #11712 from keymanapp/fix/developer/cherry-pick/11710-handle-encoding-errors-when-loading-wordlists
fix(developer): handle encoding errors when loading wordlists 🍒 🏠
2024-06-07 16:40:27 +10:00
Marc Durdin
1112830d75
Merge pull request #11709 from keymanapp/chore/developer/cherry-pick/11706-add-extra-logging-for-backspace-assertion
chore(developer): add extra logging for assertion failure when pressing backspace in debugger 🍒 🏠
2024-06-07 16:40:14 +10:00
Marc Durdin
1f1e5fba99 fix(developer): prevent two touch layout editors opening for the same file
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
2024-06-07 09:46:30 +07:00
Marc Durdin
b1374c9818 fix(developer): handle missing OSK when importing a Windows keyboard into a touch-only project
Fixes: KEYMAN-DEVELOPER-1NN
Fixes: #11719
2024-06-06 12:50:54 +07:00
Marc Durdin
b8ea8056f8 refactor(developer): rename TouchLayoutToVisualKeyboardConverter to VisualKeyboardToTouchLayoutConverter
No change in functionality. But class and unit name now match what they
actually do.
2024-06-06 12:50:53 +07:00
Marc Durdin
d1787a0645
Merge pull request #11703 from keymanapp/fix/developer/cherry-pick/11700-disable-example-edit-controls-if-no-examples
fix(developer): disable example edit controls if no examples in Package Editor 🍒 🏠
2024-06-06 12:05:12 +07:00
Marc Durdin
c01ac431db
Merge pull request #11699 from keymanapp/fix/developer/cherry-pick/11687-ignore-javascript-files-with-bad-encodings
fix(developer): treat js files with unrecognized encodings as non-keyboard files 🍒 🏠
2024-06-06 12:04:56 +07:00
Marc Durdin
5046e051e5
Merge pull request #11588 from keymanapp/fix/developer/cherry-pick/11586-handle-editor-init-after-debugger
fix(developer): handle editor initializing after debugger when setting execution point 🍒 🏠
2024-06-06 12:04:30 +07:00
Marc Durdin
8044d71d22 fix(developer): handle encoding errors when loading wordlists 🍒
Fixes: #11710
Fixes: KEYMAN-DEVELOPER-1S4
Cherry-pick-of: #11711
2024-06-06 09:23:27 +07:00
Marc Durdin
7ebccb9e62 chore(developer): add extra logging for assertion failure when pressing backspace in debugger
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
2024-06-06 08:59:40 +07:00
Marc Durdin
bb2d6a360e fix(developer): disable example edit controls if no examples in Package Editor
Fixes: #11700
Fixes: KEYMAN-DEVELOPER-1FT
2024-06-06 08:15:24 +07:00
Marc Durdin
9f4f8fcda9 fix(developer): treat js files with unrecognized encodings as non-keyboard files
Fixes: KEYMAN-DEVELOPER-201
Fixes: #11687
2024-06-06 06:53:00 +07:00
Marc Durdin
1603562e72 fix(developer): support Windows and Unicode names in .ttf
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
2024-05-31 15:39:50 +07:00
Marc Durdin
3b1a641d1b fix(developer): bundle ttfmeta library internally with kmc-keyboard-info
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
2024-05-31 15:39:48 +07:00
Marc Durdin
9c29e4f6e1
Merge pull request #11583 from keymanapp/fix/developer/cherry-pick/11581-flicks-for-default-key-hints
fix(developer): correct the inference of default hint from flicks 🍒 🏠
2024-05-31 13:07:16 +07:00
Marc Durdin
9a554ffa20
Merge pull request #11578 from keymanapp/fix/developer/cherry-pick/11574-fixup-flick-multitap-in-layer-props
fix(developer): use correct variable when fixing up flick and multitap in Layer Properties dialog 🍒 🏠
2024-05-31 13:07:00 +07:00
Marc Durdin
8b69ac256f
Merge pull request #11576 from keymanapp/fix/developer/cherry-pick/11573-save-selection-when-loading-state
fix(developer): save touch layout editor selection when loading state 🍒 🏠
2024-05-31 13:06:48 +07:00
Marc Durdin
fd117edab5
Merge pull request #11564 from keymanapp/fix/developer/cherry-pick/11562-handle-missing-data-in-kps-keyboard
fix(developer): handle missing data in .kps `<Keyboard>` 🍒 🏠
2024-05-31 13:06:41 +07:00
Marc Durdin
694837cd2d
Merge pull request #11556 from keymanapp/fix/developer/cherry-pick/11554-handle-invalid-default-project-path
fix(developer): handle invalid default project path in options 🍒 🏠
2024-05-31 13:06:25 +07:00