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

Text style support #22

Closed
shikanime opened this issue Oct 11, 2018 · 10 comments
Closed

Text style support #22

shikanime opened this issue Oct 11, 2018 · 10 comments

Comments

@shikanime
Copy link
Member

shikanime commented Oct 11, 2018

At the moment all text present in the project is using a default black colour and default Robot font family.

The solution i found is simply add a text style parsing implementation in the SketchStyleParserSerivce.

@shikanime
Copy link
Member Author

shikanime commented Oct 11, 2018

My current implementation work https://github.com/sfeir-open-source/xlayers/tree/text-styling.
But I discovered that some demo files (md-components-cards-safari.skecth) display inconsistent colours from the preview and editor using the latest MacOS Sketch until we change the colour and save it again.

@manekinekko manekinekko modified the milestone: beta Oct 12, 2018
@manekinekko manekinekko modified the milestone: beta Oct 22, 2018
@shikanime
Copy link
Member Author

shikanime commented Oct 24, 2018

I have problems with the "bplist" parser.
Using a version 43 of sketch file with a single string with simple color, it crashes when it tries to parser a sub-list that is not a "bplist" or "plist" but just a "list".
screenshot at oct 24 15-01-01
screenshot at oct 24 14-59-12
screenshot at oct 24 14-59-51

@shikanime
Copy link
Member Author

shikanime commented Nov 23, 2018

I noticed that the "text" class of demo files have different width and color from JSON and from what SketchApp show, after re-editing it everything have real value.
How can the editor find the real color/width with unvalid information in the JSON ? 🤯 🤯

@manekinekko
Copy link

Can you elaborate on that more in details ?

@shikanime
Copy link
Member Author

shikanime commented Nov 23, 2018

For example in the md-components-cards-safari.sketch:
That happen for all text rect, there is an example:

{
  "frame": {
    "_class": "rect",
    "do_objectID": "137D1F63-2FEE-4720-954E-3684AFDF1CD7",
    "constrainProportions": false,
    "height": 24,
    "width": 241, <--
    "x": 18,
    "y": 137
  }
}

image

But in fact the color and the width are different:
image

And after double clicking the any text element, the real color show up (But it doesn't match the preview file color):
image

When saving the file without any changement the width are fixed in xLayer:
image

I tried every version from version 50.3 to latest for a couple of demo file, assuming that the original file were around 51.1.
🤯🤯

@manekinekko
Copy link

Well, well, that's unfortunate. Maybe a bug in SketchApp? Can we prevent this on our side?

@shikanime
Copy link
Member Author

shikanime commented Nov 23, 2018

In fact, this seems difficult to prevent even if we create an exception on the "text" class in the style parser that will break correct files (I still didn't find how they handle the color/width correction).
But if we assume that all demos files could have been corrupted the actual xLayer's style parser work as it should (color and size).

@manekinekko
Copy link

Fair enough. We should probably organize the demo files by SketchApp version. This would help us quickly identify corrupted versions. Do you still have the different SketchApp versions on your machine?

@shikanime
Copy link
Member Author

I have all SketchApp version from 46 to 52.

@shikanime
Copy link
Member Author

shikanime commented Nov 23, 2018

Btw, as you can see the previously double "text" is also fixed on preview.
xlayers sketch viewer and codegen 2018-11-23 11-41-27
That said, I don't know the context of how the demos were created.

shikanime pushed a commit that referenced this issue Nov 23, 2018
shikanime pushed a commit that referenced this issue Nov 23, 2018
shikanime pushed a commit that referenced this issue Nov 23, 2018
manekinekko pushed a commit to xlayers/xlayers that referenced this issue Nov 23, 2018
* refactor: remove old text class fix

* feat: text color parsing (sfeir-open-source#22)

* refactor: typed style parser methods

* chore: comment text parsers

* test: add test for text style parser
manekinekko pushed a commit to xlayers/xlayers that referenced this issue Nov 23, 2018
* refactor: remove old text class fix

* feat: text color parsing (sfeir-open-source#22)

* refactor: typed style parser methods

* chore: comment text parsers

* test: add test for text style parser

closes (sfeir-open-source#22)
manekinekko added a commit to xlayers/xlayers that referenced this issue Nov 23, 2018
* chore: getting master and develop in an even state (#76)

* chore: merge develop (#9)

* chore: show build number in the editor UI

* docs: add more badges

* docs: update badges

* docs: update readme

* chore: use perl to tag a new build

* chore: updat version pattern

* chore: merge develop (#16)

* docs: update twitter link

* fix: auto select the layout toggle button when selecting a layer (#15)

* chore: merge develop (#17)

* docs: update twitter link

* fix: auto select the layout toggle button when selecting a layer (#15)

* docs: update contributions part

* docs: add CONTRIBUTING guide

* chore: merge develop (#20)

* docs: update twitter link

* fix: auto select the layout toggle button when selecting a layer (#15)

* docs: update contributions part

* docs: add CONTRIBUTING guide

* fix: issue #14

* chore: merge develop (#36)

* docs: add CODING_STANDARDS.md

* docs: update CODING_STANDARDS.md

* fix(docs): change base branch name from master to develop (#33)

* fix(editor): change zoom origin to center (#32)

* fix(home): change logo image and animation (#31)

* feat(packaging): add basic PWA support (#30)

* docs: add "is it maintained" badge (#1) (#34)

* chore: merge develop (#52)

* chore: add cloud build config

* chore: make all tests pass

* chore: use test:ci instead of test on a CI env

* chore: update cloudbuild config

* chore: use ngcontainer:0.5.0

* chore: add puppeteer

* chore: update docker config

* chore: set CHROME_BIN to puppeteer

* chore: switch to gcr.io/cloud-builders/npm

* chore: update COPY command

* chore: use angular/ngcontainer for testing

* chore: adding custom ngcontainer build

* chore: get built source from GCB

* chore: improved cloudbuild.yaml

* chore: update angular/ngcontainer image

* chore(deploy): use $SHORT_SHA if present

* chore: update nginx config

* chore: use nginx:latest

* chore: disable k8s deployment (temporary)

* build(Dockerfile): copy the xlayers artifacts from ./dist/html

* build: rename script to stamp-deploy.sh

* build(k8s): use a YAML template for k8s

* chore: stashing current YAML config

* build(cloudbuilder): add a custom kubectl cloud builder

* build: change stamp version pattern

* docs: add opencollective badge

* docc: update sponsors section

* chore: use angular/ngcontainer for testing

* chore: adding custom ngcontainer build

* chore: get built source from GCB

* chore: update angular/ngcontainer image

* chore(deploy): use $SHORT_SHA if present

* chore: use nginx:latest

* feat: select for demo Sketch files

now with a select you can choose from different demo Sketch files

* fix: remove invalid demo file from list

* fix: css layout

* chore(core): switch to angular master versions (#48)

* refactor: update deps to angular#master

* refactor: update links to the github repo

* chore: use different environment when loading demo files

* fix: the mat-drawer top edge was hidden behind the header

* fix: add a min-width of 1000px to the editor layout

* build: change stamp version pattern

* chore: add missing speed-measure-webpack-plugin

* build: rename the build stamp file

* refactor: exit script if env vars are undefined

* build: copy the dist artifact from ./dist/html

* build: use *.angular.run as a preview domaine

* build: update all build steps

* chore: add a test script to trigger Cloud Builds from the local machine

* chore: store the artifact inside dist/html

* chore: fix stamping script

* refactor: centralize css (#79)

* refactor: centralize css (#33)

* fix: sketch text rect width + 1 exception

* fix: unit tests (#78)

* chore: fixing failing unit tests (wip)

* fix: remove isPreview useless field

* fix: random int/float

* fix: fix canvas test

* test: remove non deterministic mock

* refactor: implement style parser test behavior

* test: bplist parser test

* refactor: group style parser unit test into sub-describes

* test: check spy return on bplist parser 64 content

* test: add more test to file dropzone

* refactor: remove generated mock from sketch layer test

* refactor: remove sketch page mock

* refactor: remove dynamic mock from sketch service test

* fix: mouse event compatibility (#75)

* build: upgrade to angular 7.1.0 (#80)

* build: upgrade to angular 7.1.0

* fix: ignore no-output-rename lint rule

* fix: use current domain as an origin to load demo files (#81)

* docs: update the wording to include vue and react

* chore: add multiple version of demo files (#84)

* feat: add new UI for demo file selection (#85)

* feat: improve text styling support  (#83)

* refactor: remove old text class fix

* feat: text color parsing (sfeir-open-source#22)

* refactor: typed style parser methods

* chore: comment text parsers

* test: add test for text style parser

closes (sfeir-open-source#22)

* feat: improve the setting sidebar IU (#87)

* fix: remove unused property
pull bot pushed a commit that referenced this issue Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants