scarpe-team / scarpe

Scarpe - shoes but running on webview
Other
162 stars 29 forks source link

Fixed the font property #541

Closed Nj221102 closed 7 months ago

Nj221102 commented 7 months ago

Description

previously font- shorthand property wasn't working properly because the specific property for the font size was overwriting the font property and it has a default value so it was never nil, hence making the size section in the font useless.

so to overcome this problem and fix it, I made some changes so now font wouldn't write to a font property, but instead to the specific ones ,which will do three things:-

  1. if there is no font property then specific properties will work as it is.
  2. but if there are some properties mentioned in the shorthand property then those properties will overwrite their respective specific property, which means the things written in the font will applied,not what's written in specific ones.
  3. if there is some property which is not present in font property, like family, italic, or weight is present in font-shorthand but no size input is there, then in this case if you write the size in specific :size property ,then it will also work.

All these features are similar to how shoes used to work

Shoes.app do

    para "The family is not in font so it will change but size won't" , font:"italic bold 30px" , family:"cursive", size: 20

    para "because  only things things who aren't present in font " , font:"bold", size: "16px"

    para "will be used as their specific property", font: "cursive italic 20px ", font_weight:"bold"

end

Image(if needed, helps for a faster review)

Screenshot 2024-02-07 at 1 42 19 AM

Checklist

noahgibbs commented 7 months ago

I'm also seeing some odd things with quoted font family versus unquoted (e.g. font: "Pacifico" vs font: "'Pacifico'"). Probably time to add some tests...

Nj221102 commented 7 months ago

@noahgibbs I have added the test for the parsing logic

Screenshot 2024-02-08 at 12 40 07 PM

Is there a need for further changes, please suggest .

noahgibbs commented 7 months ago

Thank you! Merged.