ijprest / keyboard-layout-editor

Web application to enable the design & editing of keyboard layouts
http://www.keyboard-layout-editor.com/
Other
1.32k stars 246 forks source link

Font colors and sizes don't get saved #304

Open rstacruz opened 3 years ago

rstacruz commented 3 years ago

I'm getting a pretty strange issue with my keyboard layout. If I save it then load it later, some things don't get saved - have a look at the highlighted parts in this image:

image

Link is here:

rstacruz commented 3 years ago

layout.json.zip

kbrock commented 3 years ago

The color format should follow the same thing as the label. e.g.: "X\n\nY". Unfortunately, the part that serializes the internal data structures to raw json truncates the colors and sizes: So instead of "#aaa\n\n#bbb" it saves to disk just "#aaa". As the bug suggests, the whole key gets the same color.

To temporarily fix: go into the raw json and at the beginning inside the first [ add: {t:"#ffffff\n\n\n\n\n\n\n\n#ff0000\n#000000\n#0000ff"}, -- it will show you where to put the colors and you can probably just tweak until this has been fixed.

I'm guessing the issue is due to updating the serialization formatter? I remember a comment that the serializer/deserializer are being extracted, it is probably just a bug introduced in this process

thoni56 commented 2 years ago

@kbrock What do you mean by "go into the raw json and.."?

Should we do that before we save? So once you have a good layout, and before saving, insert the "fix" and then save? And it should restore correctly?

Because I have a similar problem too and that did not fix it for me (on an Atreus, so rotation might be a complicating factor...

kbrock commented 2 years ago

@thoni56 I actually copy the first {t:""} into the description, then when I open a saved keyboard, I manually copy the t and delete a bunch of the color entries to not redefine them over the one I just pasted in. It means I can only define the color once at the beginning but it allows me to get the final result without too much raw munging.

If the keys have a pretty consistent use of the corners, then it works well. If the keys tend to have only the center or the corners defined, and those are not consistent, then the t/a values keep changing and I guess you would need to copy all the t values or something.

Is this a pain? yes. It does get me back to my desired solution though. And I'm familiar with the raw enough that I can get there.

Sometimes I copy the whole raw json into a gist.