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

Nutri-Score icon is not displayed correctly #2205

Closed
VaiTon opened this issue Jun 7, 2022 · 11 comments
Closed

Nutri-Score icon is not displayed correctly #2205

VaiTon opened this issue Jun 7, 2022 · 11 comments
Assignees
Milestone

Comments

@VaiTon
Copy link
Member

VaiTon commented Jun 7, 2022

What

A picture is worth a thousand words!


@VaiTon VaiTon added the 🎯 P0 label Jun 7, 2022
@monsieurtanuki
Copy link
Contributor

Hi @VaiTon!
I don't think it's a 5 minute fix. It looks like a svg problem: the unsolicited cropping comes probably from the svg file itself (or the way it is dealt with by flutter_svg).

Suggestions about fix/debug:

  • step 0: temporarily remove the access to internet and restart the app - you should see only the "assets" icons, not the server one
  • step 1: see if the same bad display happen (my guess: no, it's ok)
  • step 2: download the latest version of the nutriscore files and put them in assets/cache
  • step 3: see if the same bad display happen (my guess: it's NOT ok)
  • step 4: then we need someone who understands svg to delve into this and fix the icons
  • step 5: then the icons should be uploaded to the server

@teolemon
Copy link
Member

teolemon commented Jun 8, 2022

It's caused by the server. @stephanegigandet updated the visual assets based on Quentin's suggestions

@stephanegigandet
Copy link
Contributor

That's strange, the Nutri-Score SVG images have exactly the same size as before, 240x130 px.

e.g.
old image: https://static.openfoodfacts.dev/images/attributes/nutriscore-d.svg (login and password off)
new image: https://static.openfoodfacts.org/images/attributes/nutriscore-d.svg

@monsieurtanuki
Copy link
Contributor

@stephanegigandet It has nothing to do with the whole size; it has something to do with some crop effect not well understood (or over-interpreted) by flutter_svg.

@stephanegigandet
Copy link
Contributor

ok, I can try to remove the transform-matrix then

@monsieurtanuki
Copy link
Contributor

There's something different that was added/removed for B and D.

@stephanegigandet
Copy link
Contributor

I'm regenerating the SVG without transforms etc.

@stephanegigandet
Copy link
Contributor

SVGO does not have an option to flatten SVG paths unfortunately
svg/svgo#624 did point me to lean-svg which seems to work, and that showed issues with the Nutri-Score B and D icons when paths were flattened. Removing the clipPath manually in Inkscape seemed to make lean-svg work better for them.

@stephanegigandet
Copy link
Contributor

Seems to be solved by openfoodfacts/openfoodfacts-server#6872 (I deployed the new SVG icons in production, you should get them by restarting the app)

@monsieurtanuki
Copy link
Contributor

@stephanegigandet I confirm: all 6 nutriscore icons look fine now 👍

Repository owner moved this from To discuss and validate to Done in 🤳🥫 The Open Food Facts mobile app (Android & iOS) Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

4 participants