Reply to topic  [ 1 post ] 
 Blender Built-in Bitmap Font 
Author Message
Level 22
Level 22
User avatar

Cash on hand:
176,195.70
Posts: 2259
Joined: Sat Nov 17, 2012 11:10 am
Location: SR388
Group: Special Access
Post Blender Built-in Bitmap Font
In the blender 2.49b game engine, the Text object native to blender will not render, so it's always invisible. in blender 2.5 they make it visible but to do so they render each glyph on the spot by first converting the curves to polygons then rendering those the outcome is massive memory use. so we use the same old method of a 2.49b Bitmap Font

How to use a Bitmap Font:
https://web.archive.org/web/20230313064 ... 21&lang=en

How to Make a bitmap font:
https://www.blendenzo.com/tutFTBlender.html

However if you take this .blend and give it to a friend either the image will be missing or the text will all be "@@@@@@@@@@ @@@@". to avoid this so you can share your blender games with lots of text with friends, you need to do 2 steps:

1: Pack all files into blender:
this step requires you to go to the main menu "File" and towards the bottom you'll see "External Data" click it and in the submenu select "Pack into .blend file"

now your friends can see text but it's all @@@@@@@@ because blender's text script is having trouble resolving the file location to it's packed location because the link still says the location on your hardisk. but your friend doesn't have your harddisk. so blender's script is throwing a loop :black . to fix this you need to do one more step.

2: Make All Paths Relative:
Absolute paths are like "C:/user/forkhead/downloads/hentai.png" but if the image is inside blender and your friend does not have said image at that exact location blender will get confused.
Relative paths are like "directory where .blendfile is/game.blend/images/hentai.png" because the blend file is a game archive and can store images used.

so we want relative paths for our images and sounds etc. they will be linked. However when you click "File>External Data>Make all Paths Relative" it opens a specifal menu with a few choices.
"Make Relative:"
Total Files
Changed
Failed
Linked

in this case you need to select "Linked", I tried total files, that didn't work, changed would only apply to images or sounds you changed via code in game (but blender is pretty good about that). and IDK what "Failed" would be lol. so Linked is what we want.

congrats now your game text and font will be seen by anyone who gets a copy of the game.

as for text collision bounds so it can interact with other objects and your mouse? No. that'll take extra work on your part.

word wrap? lol no. you need to program that.

alignment; left, right, centered, justified, flush?
"Left" is default
"Right" is a case of flipping things around https://www.blendenzo.com/tutRightAligned.html
"Up to down", again a case of flipping things around, https://www.blendenzo.com/tutVertText.html

others, No. you'll have to program that.

visible text cursor? nah you have to make one and program that too.

hint it has to do with a searchable dictionary[] of letters and their widths modified by object scale. if you do that you can determine where things like "Bounds" of the text are and make and scale an object or more than 1 object to that exact outline for collisions and mouse over interactions, and can also place a cursor at the correct position exactly between letters. you'll also be able to know when the letters would cross a certain point (the text box bounds) and put in an "\n" character at that point in the text string. you'll also be able to calculate position of the text box relative to an Alignment Point so when you type it can move to the left exactly that character's width and when you remove a character it can subtract that character width and move right. you can add extra spaces to fill the box for justified and flush. you can calculate the MIDDLE point of the text and move it offset so it looks like it's always exactly centered on somewhere.

to actually modify any given character in a string you'll need to actually use that character's Index by specifying from 0 + the characteer's number in the string "PINGAS"[0] = "P" index is 0, we have to do this because there is no cursor programmed into this bitmap text field.


it does not support Text Links. you'll need to make a system for that yourself and have the Link as it's own object ready to spawn at a specific location setup to detect mouseover and left click.

it does not support things like Bold, Italic, Underlined, Strikethrough etc. it does not support alternative font formatting such as Font nor Color. all the text will be the same font and color, if you want to change that you'll need to program it to transition to another text object while typing when you type in some wrapper you programmed in like "color /color" (if "color" in text and "/color" in text: do something) if you want to switch a font or switch to bold italic underlines or strike through, you need to have those images ready to go on another object and again program some wrapper to trigger the transition from writing on the primary text object, to writing on a formatted text object.

Text selection is not built in, there is no cursor remember. you'll have to program that. by having a cusro go to a specific character's position and having one "selection background" object (basic plane object set to whatever color) and scale it to the character length from the cursor's start point.

Copy and paste are not native because there is no cursor nor selection. so you need to program that. luckily it is possible several ways one through the Tkinter.TK() window module and another through the ctypes module which allows you to program in C to talk with windows.

Color changeing, you can do it, even by hex input but again you'll need to program it, and you'll need to have as many different text object duplicates as the number of colors text can use in 1 text object (hint it will never be infinite)

yay. not really no, lol. it's a chore. a big chore, but it can be done this way. at least theres a foundation to build on.

_________________
mepsipax

Image

got any?

His name is not Robert Paulsen, His name is Gregory Matthew Bruni, he won so hard.

_________________
Click the icon to see the image in fullscreen mode  
1 pcs.
Click the icon to see the image in fullscreen mode  
1 pcs.
Click the icon to see the image in fullscreen mode  
1 pcs.
Click the icon to see the image in fullscreen mode  
1 pcs.


Tue Mar 19, 2024 8:14 pm
Profile E-mail
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 
 

Similar topics

 
Blender 2.49b Python 2.6.2
Forum: Tokyo U
Author: joshex
Replies: 8
Blender Navigation Basics: the how to and where is it thread
Forum: ./Tutorials
Author: joshex
Replies: 1
Security font colour ugly.
Forum: ./General Spam
Author: cluelessfurball
Replies: 3
LOOKING FOR A WELL BUILT MALE AGED 18-30
Forum: ./General Spam
Author: 「H A N Z O」
Replies: 1
Top


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Mods Database :: Imprint :: Crawler Feeds :: Reset blocks
Designed by STSoftware for PTF.

Portal XL 5.0 ~ Premod 0.3 phpBB SEO