-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fixed the font property #541
Conversation
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... |
@noahgibbs I have added the test for the parsing logic Is there a need for further changes, please suggest . |
lacci/lib/shoes/drawables/para.rb
Outdated
@@ -1,7 +1,8 @@ | |||
# frozen_string_literal: true | |||
|
|||
class Shoes | |||
class Para < Shoes::Drawable | |||
class Para < Shoes::Drawable | |||
require_relative 'font_helper.rb' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor thing, but it probably makes more sense to put the require up at the top unless it's inside a method. In this case, up top makes more sense.
@@ -0,0 +1,62 @@ | |||
module Font_helper |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Normally you wouldn't use an underscore here. It would be FontHelper rather than Font_helper.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done : )
@@ -0,0 +1,62 @@ | |||
module Font_helper | |||
|
|||
def self.parse_font(font) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want an includable module, you'd normally define these as instance methods (e.g. "def parse_font") rather than self methods. It would be fine to have it free-standing like this and call FontHelper.parse_font, but then you don't need the includes for it. Or you could use the includes, call the methods as "parse_font" rather than "FontHelper.parse_font" and not define them with "self" in front.
Thank you! Merged. |
regex = /\s+(?=(?:[^']*'[^']*')*[^']*$)(?![^']*,[^']*')/ | ||
result = input.split(regex) | ||
|
||
fs = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an excellent contribution. Thank you!
One thought, no need to take action but thinking out loud.
For readability in future it could be nice to use descriptive variable names; for what concept they are representing.
(Thinking about the "fs, foss, etc.")
Thanks again!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the advice , will keep that in mind while writing code in future : )
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:-
All these features are similar to how shoes used to work
Image(if needed, helps for a faster review)
Checklist