Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization of Designspaces mangles lib #338

Open
madig opened this issue Dec 28, 2023 · 2 comments · May be fixed by #339
Open

Serialization of Designspaces mangles lib #338

madig opened this issue Dec 28, 2023 · 2 comments · May be fixed by #339

Comments

@madig
Copy link
Collaborator

madig commented Dec 28, 2023

I noticed that code like

serde_json::to_value(norad::designspace::DesignSpaceDocument::load(path).unwrap()).unwrap()

returned mangled libs, that look like

{array: {string: "_typoquote"}, dict: {dict: {key: "tH", string: "67"}, key: "F333AEC5-BB61-4D5E-9EDD-6124322D28F2"}, key: "public.skipExportGlyphs"}

when it should instead be https://gitlab.gnome.org/GNOME/cantarell-fonts/-/blob/cd2155cf5696082cc14706e0f93a9ad7a1b4dab1/src/Cantarell.designspace#L74-156. As in, it seems to mirror the verbatim plist structure of separate key and value elements. I don't understand why that happens...

@madig
Copy link
Collaborator Author

madig commented Dec 29, 2023

Huh. If you serialize the DesignSpaceDocument instance, you get a mess:

  "lib": {
    "dict": {
      "array": {
        "string": "_typoquote"
      },
      "dict": {
        "dict": {
          "key": "HV",
          "string": "176"
        },
        "key": "51C2DFEF-3776-4D13-9284-96485B799B57"
      },
      "key": "public.skipExportGlyphs"
    }
  },

and if you serialize the .lib specifically, you get the proper data:

{
  "GSDimensionPlugin.Dimensions": {
    "0B2E441B-685E-400D-9B9B-E078DEED62EF": {
      "HH": "19",
      "HV": "22"
    },
    "51C2DFEF-3776-4D13-9284-96485B799B57": {
      "HH": "156",
      "HV": "176"
    }
  },
  "public.skipExportGlyphs": [
    "_slash.zero",
    "_slash.zero.osf",
    "_typoquote"
  ]
} 

@madig madig linked a pull request Dec 29, 2023 that will close this issue
2 tasks
@RickyDaMa
Copy link
Collaborator

and if you serialize the .lib specifically, you get the proper data

That'll be because at that point you're serializing plist::Dictionary with plist's implementation, not norad's serde_xml_plist module, which doesn't rely on plist's implementation for the lib/anything AFAIK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants