[personal profile] rosefox posting in [community profile] style_system
I just tried to edit my style and got this error:

S2 Compiler Output at Sun Sep 13 02:31:23 2009
Error compiling layer:

Compile error: line 170, column 5: Can't override property 'font_base_size' of type string with new type int.
S2::NodeProperty, S2/NodeProperty.pm, 120
S2::NodePropGroup, S2/NodePropGroup.pm, 77
S2::Checker, S2/Checker.pm, 374
S2::Compiler, S2/Compiler.pm, 34


Context

166: property string font_base {
167: des = "Default Font for the page";
168: note = "This font will apply to the entire page as the base font. If you set any of the other font properties below, they will override this setting for that specific part of the page.";
169: }
170: property int font_base_size {
171: des = "Default Font Size for the page.";
172: }
173: property string font_header_title {
174: des = "Font for the Header Title";




What I can't figure out is why it expects it to be a string.

To confuse things further, this code has been in my style for ages and has always compiled fine before. It's completely unrelated to what I was changing. In fact, when I refresh the page and then hit "Save & compile" without making any changes at all to my existing and entirely functional style, I get that error.

Any idea how to fix it?

EDIT: I gave up and made all the ints into strings, and it mostly seems to be working okay except that now my menu bar is a million pixels high because it's supposed to be the header font size plus 8 and of course you can't add 8 to a string. I may just have to hardcode that. GRRR.

Date: 2009-09-13 04:12 am (UTC)
branchandroot: oak against sky (Default)
From: [personal profile] branchandroot
It expects it to be a string because font_base_size is defined as a string in the Core layer. About a third of the way down here, the font properties start to be set; you can check the format of whatever you need to override.

It does seem like the size properties should be integers, though; that might be worth submitting as a general S2 bug.

Date: 2009-09-13 06:19 am (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Can't be integers; the problem is that they won't work for point sizes (so example, 1.5em or 0.8em, we need it to be a string for the 1.5, 0.8, etc, in addition to full unit sizes.

Date: 2009-09-13 09:25 am (UTC)
ninetydegrees: Art: self-portrait (Default)
From: [personal profile] ninetydegrees
Very common with proportional units, which are recommended for better practices. Some defaults sizes in browsers are set with decimals. For example, H2 headings are set to 1.5em, H3s to 1.17em, etc.

And Dreamwidth base font size is set to 0.75em.
Edited Date: 2009-09-13 09:29 am (UTC)

Date: 2009-09-13 12:20 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
I think it's not usual for absolute font sizes (px. pt?) but is for relative font sizes (em, %)

Date: 2009-09-13 04:21 pm (UTC)
branchandroot: oak against sky (Default)
From: [personal profile] branchandroot
Oh dear. That makes things a lot harder. *frowns* There should be a programming language category for this, one that allows for math to be done with the property. I don't suppose 'float' would work... *has never actually used float or double in her programming*

Date: 2009-09-13 06:16 pm (UTC)
afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
From: [personal profile] afuna
Float or double, I guess. (But S2 doesn't support it D:)

I wonder if we could at least hack in a function that lets you try to add strings and ints? that is, if it's possible to make it a number, then calculate it as a number... I imagine that would be possible.

Date: 2009-09-13 06:20 pm (UTC)
branchandroot: oak against sky (Default)
From: [personal profile] branchandroot
*thoughtful* That does seem possible. I think there would have to be a case for each type of increment, to define how it's calculated, but ems and percentages are both a nice base ten scale, so it should be possible to do.

Date: 2009-09-13 01:47 pm (UTC)
av8rmike: Neo from Matrix, text: I know S2 (I know s2)
From: [personal profile] av8rmike
That (making the font sizes be integers) made sense to me too, when I first implemented the font size properties, but then I realized there would be no way to do proportional sizes. That would be a big no-no on this site for accessibility reasons.
Edited Date: 2009-09-13 01:55 pm (UTC)

Date: 2009-09-13 04:27 pm (UTC)
branchandroot: oak against sky (Default)
From: [personal profile] branchandroot
*gales of laughter over your icon*

Well, perhaps you know, then. As I was just mentioning to Afuna, it really does seem useful to set those properties as math-able things. Does S2 allow for setting something as a float? And do you think that would work? I could forsee a bit of screwing around with "if no decimal add .0 to end" or "if increment equals % strip the .0 off again" to deal with non-decimals, but if it let people work with these things as numbers, it might be worth it.

Date: 2009-09-14 12:20 am (UTC)
av8rmike: Neo from Matrix, text: I know S2 (I know s2)
From: [personal profile] av8rmike
No, S2 doesn't include a float or double primitive. Other than this particular application, I can't think of many other places where you'd need support for decimals. Can you?
I would have to experiment to see if the language even allows converting between variable types.

Profile

Dreamwidth style system discussion

April 2025

S M T W T F S
  12345
6 78910 1112
13 141516171819
2021 2223242526
27282930   

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 1st, 2025 10:08 am
Powered by Dreamwidth Studios