epam / Indigo

Universal cheminformatics toolkit, utilities and database search tools
http://lifescience.opensource.epam.com
Apache License 2.0
290 stars 99 forks source link

New text entities in KET-format #1970

Open even1024 opened 1 month ago

even1024 commented 1 month ago

Background Current implementation has a lack of text formatting features implemented in other chemical formats (CDX/CDXML). Mostly it's related to paragraph-formatting features: indents, and left-center-right layouts.

Here is an example of new text entity in KET:

{
    "type": "text",
    "bounding_box": {
        "x": 0,
        "y": 0,
        "width": 320,
        "height": 200
    },
    "alignment": "center",
    "indent": {
        "left": 10,
        "right": 10,
        "first_line": 20
     },
     "font":{
        "family": "Arial",
        "size": 18,
        "color": "#000000"
    }
    "italic": true
    "paragraphs": [
        {
             "alignment": "center",
             "indent": {
                "left": 10,
                "right": 10,
                "first_line": 20
             },
             "font":{
                  "color": "red",
             },
             "underline": true
             "parts": [
                 {
                     "text": "The quick brown "
                 },
                 {
                    "text": "fox jumps"
                    "font": {
                        "size": 22
                     },
                     "bold": true,
                     "italic": false,
                     "superscript": true
                 },
                 {
                      "text": " over the lazy dog"
                      "italic": false,
                 },
             ],
        },
        {
             "alignment": "left",
             "indent": {
                "left": 10,
             },
              "parts": [
                  {
                      "text": "Sphinx of black quartz, judge my vow."
                  }
              ]
        },
        {
             "alignment": "left",
             "indent": {
                "left": 10,
             },
             "parts": [
                 {
                     "text": "H"
                 },
             "parts": [
                 {
                     "text": "2"
                     "subscript": true,
                 },
              "parts": [
                 {
                     "text": "O"
                 }
              ]
        }
      ]
}

Since this change is not backwards compatible, version 2.0 of the KET format is being introduced with ket_version field:

{
    "ket_version" : "2.0",
    "root": {
    }
}

Also, a new Indigo "ket-saving-version" option is being added to Indigo API. This option is a string value in the format: "major_version.minor_version". For example if ketcher expects Indigo response in KET-format, the option should be added into request. The same approach is already implemented with mol-format and corresponding "molfile-saving-mode" option.

Alternatives A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

AlexeyGirin commented 6 days ago

Moved to 1.22 rc1 as agreed on the meeting