Resources and Support | |
![]() |
![]() |
![]() ![]() |
Author | Message |
yrizoud
Commander ![]() ![]() Joined: 03 May 2021 Location: France Online Status: Offline Posts: 343 |
![]() ![]() ![]() Posted: 06 January 2015 at 4:31pm |
I just created a Lua script for Grafx2 to help convert (import) bitmap fonts, and wanted to share.
http://pastebin.com/AVfjYLvg Example : Here's (part of) an image before conversion, with random space on every side and arbitrary space in-between. (Made with Times New Roman and a bit of pixel effects) ![]() Here's after running the script : ![]() The top lines are what Grafx2 uses to determine the width of each character, and the image is clipped to the smallest useful rectangle. After saving the resulting file in Grafx2's font directory, restarting and using the Text tool : ![]() |
|
![]() |
|
DawnBringer
Commander ![]() ![]() Joined: 11 August 2024 Online Status: Offline Posts: 568 |
![]() ![]() ![]() |
Nice. I assume all chars must be placed on one row?
Btw. How do you get that line break instruction in the text-window? |
|
![]() |
|
yrizoud
Commander ![]() ![]() Joined: 03 May 2021 Location: France Online Status: Offline Posts: 343 |
![]() ![]() ![]() |
Yes, single row. I know it can get annoying with large fonts, most tools of grafx2 get limited by the viewport size.
You enter line breaks with ctrl-enter. |
|
![]() |
|
neota
Commander ![]() ![]() Joined: 27 November 2018 Online Status: Offline Posts: 158 |
![]() ![]() ![]() |
Whenever I see multicolored fonts,I think about the problem of palettes; I basically don't want to use mcol fonts without the ability to recolor them (due to visibility issues etc). Is there any plan to eventually support multiple palettes per font (eg. by using GIF with frame-local palettes?) in GrafX2?.
If I understand your script correctly, it doesn't care whether the font is mono or multicolored, right? I'll try that out.. Edited by neota - 10 January 2015 at 5:36pm |
|
absolutely.
|
|
![]() |
|
DawnBringer
Commander ![]() ![]() Joined: 11 August 2024 Online Status: Offline Posts: 568 |
![]() ![]() ![]() |
The fonts, when used, become brushes that are remapped...and if you change the palette you can remap again, like any brush.
The fonts are normal images, you can make a new font by just changing the palette and saving under a new name. However I think a restart may be required for the program to find a new font. |
|
![]() |
|
yrizoud
Commander ![]() ![]() Joined: 03 May 2021 Location: France Online Status: Offline Posts: 343 |
![]() ![]() ![]() |
Yes, Grafx2 is already designed to mix pieces of images that have different palettes.
When you render text, the resulting brush is remapped to your current image's palette. If you want to use the font to its fullest, you can hit F11 ("get brush colors") to add the brush's original colors into your image, in unused slots of the palette - and without creating duplicates. The brush is then immediately recolored to this better palette. The brush doesn't remap automatically when you change palette or switch between Main and Spare page. When you want, you can hit F12 to remap brush, it will find the most suitable colors in the current image's palette, and recolor the brush accordingly. |
|
![]() |
|
neota
Commander ![]() ![]() Joined: 27 November 2018 Online Status: Offline Posts: 158 |
![]() ![]() ![]() |
^ I think there has been a miscommunication. I'm aware of that functionality, but it doesn't relate to modifying the base colors that the font is rendered with; For example, rendering your example font with brown at the bottom and a red->yellow gradient rather than a brownish->pale green-blueish gradient. Or very dark blue at the bottom, with sky blue -> white gradient at the top. As far as I know GrafX2 does not support directly swapping the font palette, only the functions you described (copying a single fixed palette into the current image palette, or adapting the fixed font palette to the current image palette)
Dawnbringer, what you said addresses the issue.. although, it's still not very practical unless I misunderstand: I would need to generate the brush, switch to spare page, 'brush to image', modify the palette, 'image to brush', switch back to main page, to achieve the recolor, yes? On another topic, can anyone see the error in this bitmap font I just made? ![]() The problem appears to be around this area: ![]() Since grafx2 displays all characters up to and including < correctly, but every following character is offset by one (eg. > becomes ?, ? becomes @, @ becomes A, A becomes B..). This would suggest that there is a problem with the > character, but I just don't see any difference between the way it's laid out and the way the other characters are laid out. Maybe it's the < character that's actually causing the problem, but I haven't noticed anything weird about that either. EDIT: Never mind, was missing the = character. Edited by neota - 10 January 2015 at 8:20pm |
|
absolutely.
|
|
![]() |
|
yrizoud
Commander ![]() ![]() Joined: 03 May 2021 Location: France Online Status: Offline Posts: 343 |
![]() ![]() ![]() |
If you have a fixed amount of text to set, the simplest is to render the string "as is", paste it in the empty Spare page, and edit all you need there. When it looks good, grab it and bring it back to the Main page. Using Remap if the palettes are different, and "Add brush colors" if the host image really doesn't have suitable colors.
If you're going to use several strings, you don't want to repeat these changes every time, so instead you can edit the font file directly from within Grafx2. Each time you save the file, it's taken into account for the Text tool, so you can preview the result in the target image. |
|
![]() |
|
neota
Commander ![]() ![]() Joined: 27 November 2018 Online Status: Offline Posts: 158 |
![]() ![]() ![]() |
Ah thank you, that's good news about any edits saved taking effect immediately; So what Dawnbringer said about a restart being necessary is not true. That makes it much more practical :)
|
|
absolutely.
|
|
![]() |
|
yrizoud
Commander ![]() ![]() Joined: 03 May 2021 Location: France Online Status: Offline Posts: 343 |
![]() ![]() ![]() |
If you create a font you'll need to restart once, because the list of fonts is only created on startup.
|
|
![]() |
|
![]() ![]() |
||
Forum Jump |
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |