Add combining 'accent_arrow_right'

It's the first modifier that uses combining diacritics. Whether it
should be represented as a modifier or a new kind of key can be
reconsidered later.
This commit is contained in:
Jules Aguillon 2022-06-05 13:51:09 +02:00
parent e4e54628b7
commit 02124dd71f
4 changed files with 32 additions and 1 deletions

View File

@ -64,6 +64,7 @@ class KeyModifier
return maybe_modify_char(k, map_char_box(k.char_));
case KeyValue.MOD_SLASH:
return maybe_modify_char(k, map_char_slash(k.char_));
case KeyValue.MOD_ARROW_RIGHT: return apply_combining(k, "\u20D7");
default: return k;
}
}
@ -76,11 +77,24 @@ class KeyModifier
return maybe_modify_char(k, c);
}
private static KeyValue apply_combining(KeyValue k, String combining)
{
if (k.char_ == KeyValue.CHAR_NONE)
return k;
return KeyValue.getKeyByName(String.valueOf(k.char_) + combining);
}
private static KeyValue apply_shift(KeyValue k)
{
char c = k.char_;
if (c == KeyValue.CHAR_NONE)
return k;
{
// The key is a string
if (k.code == KeyValue.EVENT_NONE)
return k.withCharAndSymbol(k.symbol.toUpperCase(), KeyValue.CHAR_NONE);
else
return k;
}
c = map_char_shift(c);
if (c == k.char_)
c = Character.toUpperCase(c);

View File

@ -45,6 +45,7 @@ class KeyValue
public static final int MOD_BOX = -215;
public static final int MOD_OGONEK = -216;
public static final int MOD_SLASH = -217;
public static final int MOD_ARROW_RIGHT = -218;
/** Special value for the [char_] field. */
public static final char CHAR_NONE = '\0';
@ -188,6 +189,7 @@ class KeyValue
addModifierKey("accent_double_aigu", "\u005b", MOD_DOUBLE_AIGU, FLAG_KEY_FONT);
addModifierKey("accent_slash", "\134", // Can't write u005c
MOD_SLASH, FLAG_KEY_FONT);
addModifierKey("accent_arrow_right", "\u005d", MOD_ARROW_RIGHT, FLAG_KEY_FONT);
addModifierKey("superscript", "Sup", MOD_SUPERSCRIPT, FLAG_SMALLER_FONT);
addModifierKey("subscript", "Sub", MOD_SUBSCRIPT, FLAG_SMALLER_FONT);
addModifierKey("ordinal", "Ord", MOD_ORDINAL, FLAG_SMALLER_FONT);

15
srcs/special_font/5D.svg Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" viewBox="-20 0 2068 2048">
<path fill="currentColor"
d="M197.832 205.612h538.118q-61.2705 -48.0928 -87.4463 -102.807h38.8799q75.3359 77.7539 209.951 112.332v18.6455q-134.406 34.6621 -209.951 112.332h-38.8799q26.4688 -54.8193 87.4463 -103.197h-538.118v-37.3057zM931.256 533.22l-69.3145 69.3145
q-112.472 -86.3154 -249.792 -98.0859v-99.3945q176.555 11.7715 319.106 128.166v0zM516.679 504.45q-133.396 10.4619 -249.792 100.701q0 -1.30859 -71.9297 -74.5449l2.61523 2.61523q142.554 -116.396 319.106 -128.166v99.3945v0zM197.572 675.771
q-90.2393 103.316 -107.24 245.867h-99.3936q17.001 -181.786 137.32 -319.104l-6.53906 -5.23145l3.92285 2.61523l41.8506 43.1582q30.0791 31.3867 30.0791 32.6953v0zM1137.89 921.639h-99.3936q-17.001 -141.242 -107.239 -248.483l69.3135 -70.6211
q120.318 137.319 137.319 319.104v0zM1137.89 1018.42q-14.3857 189.633 -129.474 326.953l-69.3135 -70.6221q86.3154 -111.164 99.3936 -256.331h99.3936v0zM189.726 1272.13h0.000976562q-86.3154 -107.239 -99.3936 -253.716h-99.3945q13.0781 189.633 128.165 326.953
l-3.92285 3.92383q-1.30762 0 74.5449 -77.1611zM939.103 1414.68q-146.476 124.242 -326.952 136.014v-99.3945q139.935 -11.7705 257.639 -105.934zM516.679 1550.7q-180.478 -11.7715 -326.953 -136.013l69.3145 -69.3145q117.703 90.2383 257.64 105.933v99.3945
h-0.000976562zM931.256 533.22l-69.3145 69.3145q-112.472 -86.3154 -249.792 -98.0859v-99.3945q176.555 11.7715 319.106 128.166v0zM516.679 504.45q-133.396 10.4619 -249.792 100.701q0 -1.30859 -71.9297 -74.5449l2.61523 2.61523q142.554 -116.396 319.106 -128.166
v99.3945v0zM197.572 675.771q-90.2393 103.316 -107.24 245.867h-99.3936q17.001 -181.786 137.32 -319.104l-6.53906 -5.23145l3.92285 2.61523l41.8506 43.1582q30.0791 31.3867 30.0791 32.6953v0zM1137.89 921.639h-99.3936q-17.001 -141.242 -107.239 -248.483
l69.3135 -70.6211q120.318 137.319 137.319 319.104v0zM1137.89 1018.42q-14.3857 189.633 -129.474 326.953l-69.3135 -70.6221q86.3154 -111.164 99.3936 -256.331h99.3936v0zM189.726 1272.13h0.000976562q-86.3154 -107.239 -99.3936 -253.716h-99.3945
q13.0781 189.633 128.165 326.953l-3.92285 3.92383q-1.30762 0 74.5449 -77.1611zM939.103 1414.68q-146.476 124.242 -326.952 136.014v-99.3945q139.935 -11.7705 257.639 -105.934zM516.679 1550.7q-180.478 -11.7715 -326.953 -136.013l69.3145 -69.3145
q117.703 90.2383 257.64 105.933v99.3945h-0.000976562z" />
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.