Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Text screens on different computers looking completely different?

Author
Message
Zaxtor99
9
Years of Service
User Offline
Joined: 27th Jul 2011
Location: Boise, Idaho, USA
Posted: 19th Aug 2011 14:24 Edited at: 19th Aug 2011 15:50
Okay, I\'ve ran one my mostly text games on about 8 different PC\'s now, including high end ones with widescreen monitors. Every one the game looked and ran fine. Now I just snagged a new (err used) desktop with a 3.0 Ghz P4 Hyperthreading with a ATI X700 video card for only $50 USD. Same game on this PC loos completely different. The text is super skinny compared to all the other PCs and it makes all the screens look off center and just plain sloppy.

Since it is only this PC my game looks like this on, I assumed it was something with this PC I snagged off craigslist. So Iran an install of 9.0C Directx, 4.0 Net framework, and also made the video card driver was up to date. Ran game again, and it still looked like crap.

I added a check at the beginning of my game followed by a do-loop and a print of the current screen width/height settings, and it was correct, same as it should be and on all other PCs as well. I just don't get why it looks so different on this PC.

Also, changing the video settings on the desktop itself from 1024x768 to the games default video settings of 640x480x16 does NOT change the game from looking "wrong".

Any ideas? Suggestions?


Thanks in Advance.


- Zaxx
Zaxtor99
9
Years of Service
User Offline
Joined: 27th Jul 2011
Location: Boise, Idaho, USA
Posted: 19th Aug 2011 16:25 Edited at: 19th Aug 2011 17:23
Okay... I used a text font() command check on each computer to make sure the PC I have which is different from all the rest is defaulting to the same font as every other PC... and sure enough each computer is returning a "System" font, so that is the same. Returns on screen size are the same.

But I checked the text width and text height and this is where the results vary, resulting in my messed up screens on this one, isolated PC.

43x16 width and height for two other computers by default, but the problem PC is setting the default size of the text with the same font and same screen size setting to 38x15.

So now my question is WHY the difference, and whats the easiest way to fix this? I understand I can check for the width and height at the beginning of the program and set variables to for my text size commands that could be a little higher if the width is smaller as in this case. I don't see any commands to directly just change the text width besides the set text size command.

Again tho, why would the set text size 15 command on one computer with the exact same font and exact same screen size settings return different widths and height values as a set text size 15 command on another PC ?? And what is the easiest way to fix this and make the program make sure every computer is the same?

-----------------
Update: I tried using the following with no success:

At the beginning of my program:

A$=text font()
w=text width(a$)
TM#=1.0
if w<>43 then TM#=43.0/(43-w)


and then I changed my text size commands as follows:

set text size int(15.0*TM#)

(which I figured just adding this to each set text size command in my program might do the trick)

But this doesn't work right.. and it still is not right.

*scratches head*
-------------------



- Zaxx
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Aug 2011 02:40
@Zaxtor99

When DBC was updated from 1.13 to it's current version, it became necessary to add the character set flag to any calls to SET TEXT FONT. You will also find it necessary to call a sync whenever the text size is changed in order to register it properly when calling TEXT WIDTH() or TEXT HEIGHT() or TEXT SIZE().

So, let's say you want to change the font to arial using the English character set:

SET TEXT FONT "arial",1

The ,1 is the flag for the English character set. Other character set's can be found in the setup.ini file. For convenience, I listed them here:



The other thing to note is that when using PRINT, your assignments of fonts will have no effect on the output.

For your fonts to work you'll have to use the TEXT or CENTER TEXT commands.



Enjoy your day.
Zaxtor99
9
Years of Service
User Offline
Joined: 27th Jul 2011
Location: Boise, Idaho, USA
Posted: 20th Aug 2011 03:57
Okay Latch, thanks for that info...

But I am still VERY confused as to the question that I asked in my very first post.

My entire game was written with "SYNC OFF" and absolutely no sync commands. There are also no font changes, nor are there any calls for text width(), text height(), or text size(). The game works great on like 8 different computers, everything from 7 year old celeron CPUs with no graphics card to a brand new quad core AMD with a 4570 video card. But this one PC, all of my text is a little off center and it just doesn't look neat as it was programmed to.

The only reason I called for returns on the text font, text width and text height was to see why the difference. I put the checks at the very beginning of the program on 4 different PCs with a do-loop afterward so that essentially it was just a small check for text width & height program. with the default text size of 10 (no text size set, no font set) 3 PCs where my program works great gave me the same values of 43 width and 16 height. The awkward text PC gave me values with the exact same coding of 38 width and 15 height...WHICH MAKES SENSE and explains why my program looks awkward on that isolated PC.

My big question is WHY would one PC by default have a completely different text width and height then all others?

And with the info you have provided, what is the easiest and best way to code my program now so that it makes sure every PC text sizes are equal width and height so that it looks the same on any isolated PC like this one? Again, the only reason I tried putting text with() and text height() checks was to discover why this PC looked so different from all the others.


Thanks again



- Zaxx
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Aug 2011 05:57
Quote: "My big question is WHY would one PC by default have a completely different text width and height then all others?"


This goes back to setting the font directly and using a character set. Since various machines can be set up to use ANSI or UNICODE, calling the character set may be necessary for DBC to determine how to display and size your fonts.

Any computer running a windows operating system can have default fonts set for various purposes: menus, titles, even a default font and font size for the shell UI. There's a startup file, I'm not sure if it's still used or not for windows 7, called win.ini. There is a setting one can use to set the default system font under the windows section.

SystemFont=

Now, to complicate matters a little more, there is another file SYSTEM.ini that controls the VGA and fixed fonts for the system. It is likely that the settings here are what influence the default SYSTEM font in DBC - unless, it is over-ridden by the setting in WIN.INI.

In SYSTEM.INI, the fonts settings are in the boot section and the settings are:

oemfonts.fon=
fixedfon.fon=
fonts.fon=

Depending on the settings within these 2 ini files, the default font and I imagine the text size in DBC could vary from machine to machine - at least that is my suspicion.

However, if we call the font ourselves and use a character set flag, then we are forcing DBC to use the font of our choosing. If the font name identified when calling SET TEXT FONT "name",1 is a windows standard, then we can expect that the font will be sized consisently from machine to machine. If the font only exists on the machine where the source code was written, then the other machines will default to their system font which, as you have seen, can give unpredictable results without knowing the defaults of the other machines.

Quote: "And with the info you have provided, what is the easiest and best way to code my program now so that it makes sure every PC text sizes are equal width and height so that it looks the same on any isolated PC like this one? Again, the only reason I tried putting text with() and text height() checks was to discover why this PC looked so different from all the others. "


Since DBC uses DirectX 7 as it's API, everything you see displayed is rendered (drawn) to a direct draw surface (DDS). So, when you ask for text to be displayed, it uses the graphics control of Windows called GDI, to create the text of the appropriate size using the font system of windows. This is then rendered to a DDS then copied (blitted) to the main display screen. Therefore, to manage the updates and refreshes yourself, it's good to set a sync rate and call sync yourself. Otherwise, DBC manages when to sync and it might not do things exactly when you want.

When you use the Print statement, DBC just uses the default system font for everything. You can't change the size, you can't change the font.

When you use text or center text, you are forcing DBC to render the font with whatever information it has last saved regarding the text size and the font type. If you haven't set one or the other, then DBC will use whatever it gleaned from the default.

So, in theory, to make sure your text is always the same on each computer, set a sync rate, set your font type, set your font size then call SYNC. And always use the Windows basic font set so you know everyone has the same fonts. If there is a non standard font you want to use for your game then you would have to have a method of installing that font on other machines.

You only have to call a sync when you are changing these attributes (set text font; set text size). You can of course wait for the sync in your main loop if you position (time) you code properly - but you generally wouldn't want to waste any clock cycles by constantly changing or resetting your fonts so it's usually good to only call the font changes when you need them.

Another way of manging your font type and size and have them consistent on each machine is to use bitmaps. Create you text on bitmaps and either display them as pasted images, sprites, or textured on 3d objects. Include these images as media with your program.

Enjoy your day.
Zaxtor99
9
Years of Service
User Offline
Joined: 27th Jul 2011
Location: Boise, Idaho, USA
Posted: 20th Aug 2011 06:31 Edited at: 20th Aug 2011 07:00
Okay sweet Latch... thanks sooo much!

I understand now, and also what I need to do to fix my program.

Your in depth answer was EXACTLY what I was looking for and I very much appreciate the time you put into answering my questions. It's a little more technical then I was hoping, but that also helps explain my confusion (speaking of all the windows ini and system ini files and settings, etc)

I'll also what I need to do in my future projects to prevent such machine specific abnormalities.

One more quick Question:
If I have the same font used on a particular screen, but have multiple set text size commands creating several different sizes of text on the same screen, should I call a "Sync" right after each separate "set text size" command OR can I use only a single SYNC command after I draw all the writing in different sizes on the same screen? (Such as right before waiting for the user to input a choice or click a mouse button to continue on for example)


Thanks again!!


- Zaxx
Latch
14
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 20th Aug 2011 13:11 Edited at: 20th Aug 2011 13:13
Quote: "One more quick Question:
If I have the same font used on a particular screen, but have multiple set text size commands creating several different sizes of text on the same screen, should I call a "Sync" right after each separate "set text size" command OR can I use only a single SYNC command after I draw all the writing in different sizes on the same screen? (Such as right before waiting for the user to input a choice or click a mouse button to continue on for example)"


That shouldn't be too hard to test. The first half of the program changes the text size several times, displays the result, and then calls a single sync. The second half of the program calls sync after each size change.



It would seem that the fonts will change size if you do multiple sizings and 1 sync. But the true text size is not recorded internally with the collective sync so if you need to query the text size, you won't get the correct information.

Enjoy your day.

Login to post a reply

Server time is: 2020-08-06 07:39:42
Your offset time is: 2020-08-06 07:39:42