joergreichert / spray

Automatically exported from code.google.com/p/spray
1 stars 2 forks source link

Better handling of text size #217

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Currently you're forced to give position, width/height and id inside a text 
definition otherwise you end up with a strange error message:

rule ruleCommonLayout failed predicate: 
 {getUnorderedGroupHelper().canLeave(grammarAccess.getCommonLayoutAccess().getUnorderedGroup_1())}?

text {
   position (x=0, y=0)
   size (width=20, height=10)
   id = fromText
}

Width and height are dependent on the text style (font, font size, character 
spacing, ...)

So defining a text size has only an effect if the font size defined by the 
style is lower or equal to the stated size (visible when backgound-color is not 
set to transparent) otherwise the for style calculated size is applied and in 
consequence the text representation is cut of at the boundaries of the 
container holding the text. 

Original issue reported on code.google.com by de.abg.r...@gmail.com on 1 Dec 2012 at 9:16

GoogleCodeExporter commented 9 years ago

Original comment by de.abg.r...@gmail.com on 1 Dec 2012 at 9:16

GoogleCodeExporter commented 9 years ago
The error message sounds like an internal Xtext error message.  No idea what 
this means. 

Original comment by joswar...@gmail.com on 2 Dec 2012 at 1:11

GoogleCodeExporter commented 9 years ago
Actually it seems to be an error message from the ANTLR parser combined with 
Xtext, here is a similar error message reported: 
http://www.eclipse.org/forums/index.php/t/261641/

Maybe this ugly error message is due to the nested ordered groups:

TextLayout: {TextLayout}
(
    (common=CommonLayout) 
    & ('align' '(' 
            (
                'horizontal' '=' hAlign=HAlign ',' 
                'vertical'   '=' vAlign=VAlign
            )? 
       ')'
      )? 
    & (layout=ShapestyleLayout)?
);

CommonLayout: {CommonLayout} 
(
    (
        'position' '(' 
            'x' '=' xcor=N_INT ',' 
            'y' '=' ycor=N_INT 
        ')'
    )? 
    & (
        'size' '(' 
            'width'  '=' width=INT ',' 
            'height' '=' heigth=INT 
        ')'
      )
);

Original comment by de.abg.r...@gmail.com on 2 Dec 2012 at 1:30

GoogleCodeExporter commented 9 years ago
Unordered,  and optional as well, may be optional part is also one of the 
cuases?

Original comment by joswar...@gmail.com on 2 Dec 2012 at 5:39