• 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.

Font Size Change in one String?

Messages
10,158
Country
us-arizona
Hey guys,


Ok.. Lets say, I wish to have a Digital Altitude data string show up. Lets say I need Hundreds of feet to be small (about 2/3rds as big) as the Thousands of feet Altitude.

Is there a way to have a string bring down part of the font to be smaller? (or vice versa)?

The String I have now is;

Code:
<String>%((A:Autopilot altitude lock var, feet) 99999 min 0 max)%!5d!</String>



Bill
LHC
 
There's a very helpful thread on formated text over in avsim's panel and gauge forum.

Try: http://forums.avsim.net/dcboard.php...ic_id=23994&mesg_id=23994&listing_type=search

If the link doesn't work for some reason, just do a search for the thread "Proper XML Syntax for TAB in a STRING"....

But the answer to your question is yes, what you want to do is possible. And if you do many gauges at all, spending a day just tinkering with formatted text, I promise you, will be well worth it.

Scott
 
Bill, didn't you pay any attention to the post the other day on "Escape Sequences?" :D
http://www.fsdeveloper.com/wiki/index.php?title=XML:_Escape_Sequences

\{fnt1}

switch to the first alternate font specified as a child of the gauge text element

\{fnt}

return to the default font

Usage: This is a snippet from the G500 code, I'll highlight the important parts in red for you to follow...

Code:
                     <FormattedText X="277" Y="222" Font="Arial Black" [COLOR="Red"][B]FontSize="14"[/B][/COLOR] LineSpacing="17" Adjust="Left" Color="0xF0D0D0" Bright="Yes">
                        [COLOR="red"][B]<Font FontSize="10"/>[/B][/COLOR]
                        <Color Value="Cyan"/>
                        <BlinkCode>@BlinkerCode</BlinkCode>
                        <ScrollY>(@g:popupMenuScroll)</ScrollY>
                        <String>
							\{rmrg=%((@g:popupMenuWidth))%!d!}
							%((@g:popupMenu) 1 ==)%{if}
								\{lsp=14}\{ladj=C}\{clr2}[COLOR="red"][B]\{fnt1}[/B][/COLOR]RUNWAY[COLOR="red"][B]\{fnt}[/B][/COLOR]\n

1. In the above, note that the "base font size" is FontSize="14".

2.Immediately following as a "child" of the "base font" is an entry for FontSize="10".

3. In the <String> notice the {fnt1}RUNWAY{/fnt} set. The word RUNWAY will be displayed using 10, and the remain parts of the <String> will revert to the "base font size" of 14

Therefore, the display for that <String> would be something like:
Code:
[B][SIZE="2"]RUNWAY[/SIZE]
[SIZE="3"] 12[/SIZE][/B]
 
Last edited:
Okay, now let's try another example, this time from something quite a bit less complicated... ;)

My goal is to produce an IAS number followed by lower-case "kt" at about one-half the font size of the IAS number.

One way to do that is to use the \{dpl=x} escape sequence:
Code:
      <Element>
          <Position X="70" Y="196"/>
          <FormattedText X="155" Y="56" Font="Arial Bold" FontSize="54" Adjust="Right" Color="Teal" Bright="Yes">
              <String>%((A:AIRSPEED INDICATED, knots) near)%!3.0f![COLOR="red"][B]\{dpl=[COLOR="black"]k[/COLOR] } \{dpl=[COLOR="black"]t[/COLOR] }[/B][/COLOR]</String>
          </FormattedText>
      </Element>

Another way would be to use the \{fnt1}xxx\{/fnt} escape sequences:
Code:
      <Element>
          <Position X="70" Y="196"/>
          <FormattedText X="155" Y="56" Font="Arial Bold" [COLOR="red"][B]FontSize="54"[/B][/COLOR] Adjust="Right" Color="Teal" Bright="Yes">
          <[COLOR="red"][B]Font FontSize="28"[/B][/COLOR]/>
              <String>%((A:AIRSPEED INDICATED, knots) near)%!3.0f![COLOR="Red"][B]\{fnt1}[/B][/COLOR]kt[COLOR="red"][B]\{fnt}[/B][/COLOR]</String>
          </FormattedText>
      </Element>

In both cases I'd wind up with something like this:

125 kt

For your specific question about the alititude, you'll have to do some "math" to separate the "thousands" from the "hundreds," but you can still write the entire number with only one string using two FontSizes. I have to leave something for you to do! ;)
 
Last edited:
Thanks Bill for the well illustrated lesson.

And I thought Algebra was difficult... lol.. This hurts! Now I see how staying in that basic computer programming course could have helped me here.

I have been using that Code Reference Text you posted. That is brilliant and most helpful on this.


Bill
 
Back
Top