• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Text wider than expected

Messages
36
Country
argentina
I'm trying to do some kind of "Flight Engineer report", in which I'd like to show some preflight parameters such as ZFW, total fuel, etc. This is what I've currently got:

Code:
<Gauge Name="Wilco A318 reference" Version="1.0">
    <Update Frequency="1"/>
    <Element>
        <Position X="0" Y="0"/>
        <Image Name="Bkg.bmp" Bright="Yes" ImageSizes="210,149">
        </Image>
    </Element>
    <Element>
        <Position X="10" Y="10"/>
        <Text X="98" Y="9" Length="14" Font="Courier New" Color="black" Bright="Yes" Adjust="Left" VerticalAdjust="Center">
            <String>%ZFW (kg/lb) = %</String>
            </Text>
    </Element>
    <Element>
        <Position X="108" Y="10"/>
        <Text X="35" Y="9" Length="5" Font="Courier New" Color="black" Bright="Yes" Adjust="Left" VerticalAdjust="Center">
            <String>%((A:TOTAL WEIGHT, kilogram) (A:FUEL TOTAL QUANTITY WEIGHT, kilogram) -)%!5d!</String>
            </Text>
    </Element>
    <Element>
        <Position X="143" Y="10"/>
        <Text X="7" Y="9" Length="1" Font="Courier New" Color="black" Bright="Yes" Adjust="Left" VerticalAdjust="Center">
            <String>%/%</String>
            </Text>
    </Element>
    <Element>
        <Position X="150" Y="10"/>
        <Text X="42" Y="9" Length="6" Font="Courier New" Color="black" Bright="Yes" Adjust="Left" VerticalAdjust="Center">
            <String>%((A:TOTAL WEIGHT, pound) (A:FUEL TOTAL QUANTITY WEIGHT, pound) -)%!5d!</String>
            </Text>
    </Element>
</Gauge>

This is what I expect:
https://www.dropbox.com/s/5o08d4dygr3urtn/Expected.png

But this is what I get:
https://www.dropbox.com/s/fs2gkjc1a7i4233/Obtained.png

What could I be doing wrong? The bitmap is 210 x 149.
 
Last edited:
Why don't you try <FormattedText> rather than <Text>.

Here's an example. Note that BackgroundColor is inserted. You might want to include that at first so you can see how large the text field appears (determined by X="31" Y="7"), and then remove it once you're satisfied.

Code:
<Element Name="READBACK Radar Alt">
  <Position X="110" Y="468"/>
    <FormattedText X="31" Y="7" Font="courier new" FontSize="8" LineSpacing="8" Color="white" BackgroundColor="gray" Bright="Yes">
      <String>%((A:RADIO HEIGHT, feet))%!6d!%'</String>
    </FormattedText>
</Element>

As well, you can combine all of your text into one <Element> - no need for four.

Bob
 
Thank you, Bob. Looks like it works, however, as soon as I remove the BackgroundColor statement, there is no text anymore displayed, so I had to leave BackgroundColor="white". Another thing I noticed is that I have to specify a 50% higher fontsize in order to get what I want.

As well, you can combine all of your text into one <Element> - no need for four.

I guess the way you suggest should be more efficient, but how can I concatenate strings in XML?
 
I presume the trouble you have seeing the text is because you chose "black" as color. That's actually #000000, which is clear. For black, use something like #101010 instead. See below.

When editing your text, momentarily delete the "e" , that is, BackgroundColor="whit", so you can see the background clearly, adjust size as needed, and then put the "e" back, BackgroundColor="white".

To be honest, in FS9, you don't need BackgroundColor. On the other hand, it is very helpful in FSX to mitigate text antialiasing that occurs in that sim.

For one element only, try something like this.
Code:
<Element>
  <Position X="10" Y="10"/>
  <FormattedText X="98" Y="9" Font="courier new" FontSize="8" Color="#101010" BackgroundColor="white" Bright="Yes">
     <String>%ZFW (kg/lb) = %((A:TOTAL WEIGHT, kilogram) (A:FUEL TOTAL QUANTITY WEIGHT, kilogram) -)%!5d!%/%((A:TOTAL WEIGHT, pound) (A:FUEL TOTAL QUANTITY WEIGHT, pound) -)%!5d!</String>
  </FormattedText>
</Element>

You can always use <Text> if desired, but you will need to play around with Length, X, and Y to get it right. Generally, FormattedText is quite a bit easier to work with.

Bob
 
Thanks a lot. I changed color to #010101 and now it works. Also, the code is easier to read and to write when combining all into a simple element. Thank you very much.
 
Back
Top