Jump to content

Create font files for Bootloader GUI's


blackosx
 Share

126 posts in this topic

Recommended Posts

 

Hi Slice

 

Yeah... I found this too.

 

You can try passing a negative value to the -l option to close the line spacing but if the font includes extended ascii or cyrillic chars then the tops/bottoms of those characters may appear in the adjacent cells.

 

EDIT: 

Here's a screenshot showing what I mean.

Baskerville 24pt. With line spacing reduced by -4 and without adjusting line spacing.

You can see one of the extended ascii chararcters is too tall and ends up in the 'z' cell.

attachicon.gifbaskerville-24pt.jpg

 

Maybe I could add an option to the script to only produce ascii chars 32-126?

This way, there will not be any extended ascii chars to move in to the characters mostly used?

 

Exclude extended but save cyrillic?

 

I also can't find why About menu is narrow. There is a bug with menu width.

Link to comment
Share on other sites

Exclude extended but save cyrillic?

 

I also can't find why About menu is narrow. There is a bug with menu width.

Okay. I'll revise the script later and post an update.

 

hmm.. okay.. I will try to have a look when I get some time. But if you can't find the bug then I don't have much chance  :P

Link to comment
Share on other sites

Okay. I'll revise the script later and post an update.

 

hmm.. okay.. I will try to have a look when I get some time. But if you can't find the bug then I don't have much chance  :P

May be we need no Y_MARGIN in Clover. Let it be in font file?

  TextHeight = FontHeight + TEXT_YMARGIN * 2;
 

Or make it settable?

Link to comment
Share on other sites

Looks good

type2_Cambria_20pt_Cell_22x25_l-2_ra.png

slice$ ./createFont.sh -t2 -s20 -l -2 -fCambria -b150,150,150 -c 20,20,20 -ra
Scanning font character metrics
===============================
................................................................................................................................................................................................................................................................
Widest Char is at index 87 | W at 20 pixels
Canvas size will be 352x400 using cell size 22x25
Building ImageMagick code sequence
Running ImageMagick to create image
Optimising /Users/slice/Downloads/createFont_v0.86/type2_Cambria_20pt_Cell_22x25_l-2_ra.png
Opening /Users/slice/Downloads/createFont_v0.86/type2_Cambria_20pt_Cell_22x25_l-2_ra.png
Link to comment
Share on other sites

Good news! Well done Slice.

I see your image shows the text and icon left justified. Can it be centred like before?

Before it also was left adjusted. Just I made it wider 640pt -> 800pt to be used with wide fonts

about.png

Link to comment
Share on other sites

OK. Great.

Will this apply to the options menu, and help page too?

 

Does Clover have to show a fixed dimension of 800px or can it be dynamic based on the width of the screen resolution with 800px as a minimum?

This could be useful for fonts with wide characters which have not been usable so far.

http://il.static.1001fonts.net/s/o/sofachrome-font-4-original.jpeg

 

post-331032-0-01905200-1434731396_thumb.png

Link to comment
Share on other sites

OK. Great.

Will this apply to the options menu, and help page too?

 

Does Clover have to show a fixed dimension of 800px or can it be dynamic based on the width of the screen resolution with 800px as a minimum?

This could be useful for fonts with wide characters which have not been usable so far.

http://il.static.1001fonts.net/s/o/sofachrome-font-4-original.jpeg

 

attachicon.giftype2_sofachrome rg_18pt_Cell_39x24_l0.png

This is Help menu with font Candara (as set in svn)

Screen Shot 2015-06-20 at 8.38.44.png

 

I can't precalculate menu width if the font is proportional so why I made fixed width menu 800px.

If some text will not fit in this width it will be truncated before output.

You may use characters of any width just not sure if all text will be visible.

Link to comment
Share on other sites

 

I can't precalculate menu width if the font is proportional so why I made fixed width menu 800px.

 

No. But menu width could be a percentage of screen resolution width with 800px as a minimum?

Link to comment
Share on other sites

No. But menu width could be a percentage of screen resolution width with 800px as a minimum?

Good idea. How do you think is there any computer controlled by Clover with screen width

Link to comment
Share on other sites

He also can set more.  1024x768 is VESA standard working even without any drivers if monitor supported it. One can use EGA monitor from 80ys. Same about QEMU.

Link to comment
Share on other sites

Hi Slice

 

I have looked in to a good way to adjust Clover’s menu width to try to accommodate wider fonts and it’s actually quite difficult. I’ve played with LAYOUT_TEXT_WIDTH while also trying to take in to account placement of animations but it’s tricky.

 

So the best solution I have come up with is to simply draw the text with a wider width and not change the placement of the menu.

 

/rEFIt_UEFI/refit/menu.c - line #1883

 

-    //TextBuffer = egCreateImage(LAYOUT_TEXT_WIDTH, TextHeight, TRUE);

+    TextBuffer = egCreateImage(UGAWidth-XPos, TextHeight, TRUE);

 


 

post-331032-0-27029500-1435385849_thumb.pngpost-331032-0-35596800-1435385857_thumb.pngpost-331032-0-72705400-1435385865_thumb.png
Link to comment
Share on other sites

  • 4 months later...

Here's what I use to squash the theme icons with imagemagick for such cases:

wsize=`identify -format "%w" "$1"`
hsize=`identify -format "%h" "$1"`
convert "$1" -resize 75%x100 -background transparent -gravity center -extent "$wsize"x"$hsize" "$1"

The line squashes the image first. Look at the resize option value, it resizes only the image width by 75% (actually 74.9%, that's vesa width / display width * 100, for my display - 1024 VESA on 1366 display) and the height remains at 100 (%), then moves the result in the center of the canvas and then extends the image canvas to its original size (the wsize and hsize variables).

Works pretty good for the icons, but won't work directly for the font images. Maybe if your script can squash the font symbols, using the same technique...

  • Like 1
Link to comment
Share on other sites

Thanks for taking time to look for a solution philip_petev. Yes. I see what you mean that -resize does not work with text. I've also looked for other solutions but nothing seems to work when drawing text with the primitive draw command. You may be out of luck with this, at least with this current script.

Link to comment
Share on other sites

Yes it can.

However, the result will not be as sharp as when generating the text from fresh.

 

EDIT: Just tested and it's not too bad.

post-331032-0-83160400-1447772705_thumb.jpg

 

Here's a font image; original and resized by 75% width

post-331032-0-34749200-1447773200_thumb.png

post-331032-0-62784700-1447773207_thumb.png

 

I will test on a smaller font also..

Link to comment
Share on other sites

Create normal font image:

$ ./createFont.sh -t2 -b 12,46,128 -f /Users/blackosx/Library/Fonts/Bedizen.ttf -s18

Results in generated file: type2_Bedizen_18pt_Cell_21x26_l0.png
 
Character grid is made using 16x16 chars:
21x16=336
26x16=416
So final image size is 336 x 416px
 
If we resize to 75% width:

$ convert type2_Bedizen_18pt_Cell_21x26_l0.png -resize 75%x100 type2_Bedizen_18pt_Cell_21x26_l0_resized.png

It won't work as final image is only 252px wide.
The character grid is made using 16x16 chars so width has to be multiple of 16.
 
Nearest multiple of 16 to 252px is 256px, so 256/336 = 0.762
So we can use:

$ convert type2_Bedizen_18pt_Cell_21x26_l0.png -resize 76.2%x100 type2_Bedizen_18pt_Cell_21x26_l0_resized.png

Results in image sized 256x416 px.
 
Now add to theme and set the following in theme.plist

		<key>Font</key>
		<dict>
			<key>CharWidth</key>
			<integer>16</integer>
			<key>Path</key>
			<string>type2_Bedizen_18pt_Cell_21x26_l0_resized.png</string>
			<key>Type</key>
			<string>Load</string>
		</dict>

post-331032-0-34936300-1447802466_thumb.png

post-331032-0-44027000-1447803441_thumb.png

Link to comment
Share on other sites

 Share

×
×
  • Create New...