keyman icon indicating copy to clipboard operation
keyman copied to clipboard

spec(developer): KMXPlus compiler

Open mcdurdin opened this issue 2 years ago • 0 comments

Introduction

The KMXPlus Compiler will be written in TypeScript. It reads a LDML keyboard .xml file, resolves imports, validates and lints the resulting data, and generates a .kmx file.

Dependencies

  • #7043
  • #7044
  • #7045

.kmx format

  • The generated .kmx file COMP_KEYBOARD structure will have the following values:
struct COMP_KEYBOARD {
  KMX_DWORD dwIdentifier;   // KXTS
  KMX_DWORD dwFileVersion;  // VERSION_160 or higher
  KMX_DWORD dwCheckSum;     // Valid whole-file checksum
  KMX_DWORD KeyboardID;     // 0
  KMX_DWORD IsRegistered;   // 1
  KMX_DWORD version;        // 0
  KMX_DWORD cxStoreArray;   // # of metadata stores
  KMX_DWORD cxGroupArray;   // 0
  KMX_DWORD dpStoreArray;   // offset to metadata stores
  KMX_DWORD dpGroupArray;   // 0
  KMX_DWORD StartGroup[2];  // 0xFFFFFFFF, 0xFFFFFFFF
  KMX_DWORD dwFlags;        // 0x0020, KF_KMXPLUS
  KMX_DWORD dwHotKey;       // 0
  KMX_DWORD dpBitmapOffset; // 0, (future enhancement: offset to bitmap from start of file)
  KMX_DWORD dwBitmapSize;   // 0, (future enhancement: bitmap size in bytes)
};

The following metadata stores are permitted:

TSS_NAME               7 // required, name of keyboard
TSS_VERSION            8 // required, string version number, "a.b", matches dwFileVersion header
TSS_COMPILEDVERSION   20 // optional, string version number of compiler version, "a.b.c.d"
TSS_KEYMANCOPYRIGHT   21 // optional, string "Created with Keyman Developer version a.b.c.d"
TSS_VKDICTIONARY      34 // optional, Dictionary of virtual key names, required for touch layouts only
TSS_KEYBOARDVERSION   36 // optional, &keyboardversion system store value

Assorted:

  • Need to track link between ldml keyboard bcp 47 metadata and .kps when compiling

Older notes:

  • will include the following standard metadata fields.
  • A wrapper must be provided as a standalone command-line tool for test
  • Steven noted that icu4x may have something useful in this regard

mcdurdin avatar Aug 05 '22 21:08 mcdurdin