Game notes max width
-
@redrum The only way I can explain this is that there must be something somewhere in the program that increases all "px" values given in notes by 30%. It would be good to get rid of it. Hardly any idea why any developers decided to have this, if I'm right.
-
A bit of topic, but .... can notes have background picture instead of background color? If so, what would the code look like?
BTW, and if it is of any use, I use text max width in some map notifications instead of a <br> at every line to keep a long sentence to not make the notification window very wide. Notification code looks like this like this:
HumansIntro=<body><p style="width: 260px"><img src="IntroLogo.png"/><br><b>Humans:</b><br>Bla bla bla.<br><img src="GreatBattleArthur.png"/><br><br></p></body>
But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose. -
@Frostion said in Game notes max width:
But strangely the text field is much wider than 260px, more like 300px. But I just adjust the number to fit the purpose.
Yes, and I would say that is bad. Then, if someone would (finally) fix this problem (if it is a problem), your layout would be messed up. Probably other mapmakers do the same, and maybe don't even realize it.
My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.
As far as background pictures go, I think that would be another topic.
-
@Cernel said in Game notes max width:
My guess is that some developer in the past felt that some notes were too small and added to the program a +30% on any dimensional values, but, of course, I'm merely surmising. If so, better getting rid of this as soon as possible.
Quite positive no. AFAIK the HTML of game notes is plopped into the Swing UI for rendering. I'd conclude it's more a problem with the dimensions calculations the HTML rendering is using. Inline styles of some elements can be overridden to stretch/fill space. You may need to include a 'filler' element that can occupy the extra space that is being used so that the 'filler' is expanded rather than the HTML engine stretching your component. For example, consider this:
<p style="width:500px"> <p style="width:250px"> </p> </p>
you might think that nested element is going to be 250px wide, but the engine sees that the component needs to be made 500px, so you the child styling might lose or might win, it totally depends on the HTML rendering engine.
Some things you can try:
- try a table, the width of tables is usually respected
- avoid nesting elements with width specifications
- see if you can get the HTML to render well in a web browser, if you can't get it to render well there, then there is not much hope in a swing HTML renderer.
-
@LaFayette I've tried in several other cases, also on otherwise completely blank or next to blank notes, as per screenshots at this thread, and it still gives 30% more pixels. Look at this:
https://forums.triplea-game.org/topic/1784/game-notes-max-width/6?page=1 -
@Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.
-
-
Save the HTML content as a ".html" file and open it in a web browser.
-
@LaFayette said in Game notes max width:
@Cernel Give it a try as a web-page. The swing rendering should not be too different, if you can't get it to work there, it's pretty guaranteed swing won't do any better.
Ok here it is what I get on a html file with this code:
<html> <body> <table width="1000px" border="1px"> <tr> <th>AAA</th> <th>BBB</th> </tr> <tr> <td>aaa</td> <td>bbb</td> </tr> </table> </body> </html>
Screenshot:
It's fully correct. So, does this prove the problem (getting 130% the pixels you ask for) is not with my system, but with TripleA?
-
We're using Swing HTML rendering, we literally can't fix it and have not coded anything to alter or manage it. The fix needs to be in crafting the HTML that renders properly in that HTML rendering engine.
-
Correct rendering in a webpage is necessary but not sufficient criteria for having it render well in the Swing HTML renderer. Said another way, if it does not work on a vanilla webpage, it certainly won't work in Swing. But even if it renders well on a modern browser, the Swing HTML renderer does not guarantee to be compliant, is old, and has no guarantee it'll do anything really correctly.
-
Well, in my opinion this is a pretty major issue TripleA is going to go along with, as mapmakers will keep formatting notes likely inherently wrong, with respect to their intentions (like @Frostion), over the years, and new mapmakers will have to find out that they are getting 30% more pixel than they wanted, so I suggest at least tracking this somewhere.
-
Tracking is for things we can fix and do something about. The problem is in the HTML and the HTML renderer, neither of which is controlled by the game engine proper.
-
Ok, anyway, if anybody is curious about this problem that, apparently, will never be possibly fixed, you can install this map:
0.zipThen, starting it, if you see what I see, you should see a table of 130 pixels wideness, while, opening the xml, you can see this is the code of the notes property:
<property name="notes"> <string/> <value><![CDATA[ <html> <body> <table style="width:100px;background-color:FFFFFF"> <tr> <th>a</th> <th>b</th> </tr> <tr> <td>c</td> <td>d</td> </tr> </table> </body> </html> ]]></value> </property>
The map works both on 1.9 and 2.0.
If you believe the wideness of the table in notes is given as 100 pixels (as it should), please upload a screenshot of it.
-
Issue tracked in:
https://github.com/triplea-game/triplea/issues/6157 -
@Cernel the HTML needs to be fixed within the constraints of the HTML rendering. There is no code fix for us to apply here. We're not modifying the HTML, we're not rendering it ourselves. There is no way we're going to change anything (short of rebuilding an HTML renderer, IE; a web-browser) that makes this exact HTML render how you want.