Ancurio / mkxp

Free Software implementation of the Ruby Game Scripting System (RGSS)
GNU General Public License v2.0
532 stars 140 forks source link

Font size problems #161

Open twuky opened 7 years ago

twuky commented 7 years ago

Hi, I've been working on setting up a game of mine with MKXP (The prebuilt version linked in the README, which I understand is dated), which for the most part is going smoothly. The only issue I'm having is that the size of the font appears drastically different depending on whether I launch from MKXP or not. I'm using a font that I put together myself. The font is pixelated so in order for it to look correctly on the screen it needs to be a certain size. When I was just running the game in RPGmaker I had set the font size to 25 and it looked fine. When Launching from MKXP, however, the font appears much smaller. In order for the font to appear correctly in MKXP I had to set the font size to 40. And while I would have been willing to make that compromise, having a font that large causes issues with text placement, namely the large size causes large vertical gaps between lines of text during message windows. I also tried pulling the MKXP executable out of LISA to test, which displayed a different size text from the other MKXP build.

I checked the other issues, closed and open, and didn't see any similar problems. Do you think this would be alleviated should I migrate to a more current build? I can provide any of the project files if deemed necessary.

Ancurio commented 7 years ago

See #22.

A more current build wouldn't change this, there is no simple solution at the moment for mkxp. If there are large vertical gaps, can't you change your message window code to reduce the space?

How did you create the font? Can you show it to me?

twuky commented 7 years ago

Sure. I saw that issue before, but didn't think it was the same issue, but now i see what it means. Would it then be possible to adjust my fonts dpi/ppi so it's congruent among both? The font was made with a pretty simple online tool. I opened it with fontforge and it doesn't seem to have any issues changing it, I'll have to look more into it to see if that type of adjustment can be made.

Changing the line height also crossed my mind, and is certainly something I can toy with but it seems like a roundabout way of fixing it? I guess by setting the font size to 40 I've already given up hope of being able to launch from either MKXP or the standard executable.

Here's the specific font I made. TQ font.zip

Ancurio commented 7 years ago

Unfortunately I don't have enough background knowledge to tell whether there are any dpi settings one could manipulate within the font. I just feed it into SDL_ttf, hoping that it does the right thing, and use its output.

You could adjust the percentage value embedded in mkxp that's quoted in #22 so that the RMXP size almost matches up with mkxp's size for normal text boxes, but then there would be mismatches again at other font sizes (assuming you use the font in multiple sizes within the game).

But you said all you wanted was a font that is literally just built from square pixels, right? Normally one uses fonts for actual scalabe vector data. If it's just colored squares, you could simply use a bitmap atlas and have the game blit / scale characters from that. Of course that would entail rewriting all relevant RGSS parts that deal with text drawing (but it would ensure 100% same results across engines).

mkxp is never going to be able to perfectly replicate RMXP's font drawing, because Enterbrain's code uses native Windows functionality for it (to which I obviously have no access, espeically in a cross-platform context).

twuky commented 7 years ago

Hey, sorry about the late response -

Thanks for the info on this, these seem to be some pretty decent routes to look down. Because it's a pixel font, I (at least at this point) always use it at the same size, and I don't really use any other fonts. If i did need it at other sizes, it probably wouldn't be in places like Game_Message where it pays attention to line height. So modifying font.cpp seems like the least headache-inducing strategy. I'll try to explore that this week.

hanetzer commented 7 years ago

@votetuckie You may want to look into the various SFont scripts which just take a bitmap/png with a key color showing where to break it and does the various blit/scaling @Ancurio mentions. Would require less dealing in the cpp code and should be roughly equivalent for windows/linux/etc.

pulsejet commented 6 years ago

I think this might be something related to the bold attribute. Wherever I am rendering fonts with regular attributes, it looks fine, but as soon as I make it bold, spacing is broken and it is bigger/looks terrible