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

FSX & FS9 XML Questions

Messages
4
Country
us-california
Hi to all, Just registered here, Hope I'm in the right forums (if not my apologizes).


I was hoping to pick someones knowledgeable brain....... I'm having a bit of trouble implementing the AlternateFont objects in one of the xml gauges I'm creating... I'm using the \{fnt1} and \{fnt} to turn on and off the alternate font using the child properties, but I can only get it to recognize the Font Size, not the the new "Font" I want to switch to... I'm fairly new to xml, so I maybe setting up the child properties incorrectly... here's a snippet of one of the elements... child properties are in bold.


Code:
    <Element>
     <Visible>(L:SPEED_HOLD, bool) (L:Mach-IAS select, bool) ! &amp;&amp;</Visible>
      <Position X="0" Y="0"/>
      <FormattedText X="40" Y="32" Font="QUARTZ" FontSize="30" Adjust="Left" Color="#BDBDDF" Bright="Yes">
       [B]<Font ID="fnt1" Font="Arial" FontSize="16"/>[/B]
        <String>%((A:Autopilot airspeed hold var,knots))%!03d!%[B]\{fnt1}[COLOR="Red"]KT[/COLOR]\{fnt}[/B]%</String>
      </FormattedText>
    </Element>

What I'm trying to do is change the "KT" to Font "Arial" and Font Size "16"... the font size part is working, just can't change the font to Arial.

I've included the Url's for reference. my understanding from the aforementioned url's this should work, as Microsoft states
"Changes a section of the text to a different font. Refer to the Escape Codes section on the codes to use to turn an alternate font on and off. Note that there can be several alternate fonts."

Any help would be much a appreciated.

http://msdn.microsoft.com/en-us/library/cc526953.aspx#AlternateFont

http://msdn.microsoft.com/en-us/library/cc526953.aspx#EscapeCodes

Best regards,

John H,
 
Actually, the topic should be in the "Gauges" sub-forum, but since it's here... :D

It's really a question of syntax. Here is a working example. Note that each "alternate" requires a separate entry. In this example, I've specified three different font sizes. I've never tried using an alternate font type, so have no example for you. If it follows the same pattern though, it would be like this:

<Font FontFace="Arial" FontSize="16"/>

Code:
			<Element>
				<Position X="508" Y="458"/>
				<FormattedText X="220" Y="100" Font="Glass Gauge" FontSize="20"  LineSpacing="19" VerticalAdjust="Center" Adjust="Left" Color="Cyan" Bright="Yes" Tabs="0,210R">
					<Font FontSize="16"/>
					<Font FontSize="18"/>
					<String>
						%((@g:FlightPlanActiveWaypoint) (>@c:FlightPlanWaypointIndex) quit )
						%\{fnt2}REMAINING DISTANCE\{fnt}\t%((@c:FlightPlanWaypointDistanceRemaining,nmiles) s0 0 !=)%{if}%(l0)%!3.1f!\{fnt1}NM\{fnt}%{end}\n
						%\{fnt2}TOTAL DISTANCE\{fnt}\t%((@c:FlightPlanWaypointDistanceTotal,nmiles) s0 0 !=)%{if}%(l0)%!3.1f!\{fnt1}NM\{fnt}%{end}\n
						%\{fnt2}FPL EST. SAFE ALT.\{fnt}\t%((L:MSA,enum))%!d!
					</String>
				</FormattedText>
			</Element>
 
Last edited:
Hi n4gix. thanks for the reply. yes I understand about the FontSize and how to set that up correctly. I have that part working. the part I'm having trouble with is the FontFace. I have tried following the same format as with the Fontsize, i.e. <Font FontFace="Arial"/>, or <Font Font="Arial"/> but it does not recognize the format which results in the text not displaying at all.... I can go about it in a different way by creating a separate Element for that text string, but I was hoping it could be done as stated in the SDK, because I will be implementing a lot of text labels based on the FCU settings.

I have emailed MS ESP support asking the same question, if I get a response I will post my finding here (I doubt they will show much interest :( ), if you manage to get it working plz do the same.

Regards,

John H
 
As I said earlier, I've never tried changing fonts in a <FormattedText> string before.

I do know that there are some things that simply don't work unless the entire "gauge" is scripted using the new and overly verbose FSX/ESP XML Schema.

Although there never was an "XML SDK" for FS9, and the one for FSX barely deserves the name SDK, I think that the FS8/9 XML Schema does not support the "FontFace" attribute.
 
As I said earlier, I've never tried changing fonts in a <FormattedText> string before.

I do know that there are some things that simply don't work unless the entire "gauge" is scripted using the new and overly verbose FSX/ESP XML Schema.

Although there never was an "XML SDK" for FS9, and the one for FSX barely deserves the name SDK, I think that the FS8/9 XML Schema does not support the "FontFace" attribute.


Thanks n4gix, I'll take a closer look at the XML schema, but you would think if it picks up the FontSize it would pick up the FontFace, but what you say makes sense regarding the FSX/ESP scripting. the FSX/ESP SDK surely lacks some definition. I tried it in both FSX/FS9, I believe it has to do with the layout of the child properties, or as you mentioned incorrect schema/Style. hopefully MS will puts some light on the matter.

Thanks again for the help

John H
 
Well, I've found more than a few of the "attributes" listed in the FSX SDK will work in FS9, but not completely.

For example, <Arc> and <Pie> will work in FS9's Schema, but some of the "sub-attributes" of both will not.

In FS9 Schema we are limited to drawing a fixed size <Pie> or <Arc>, but in FSX's Schema we can animate the <Pie> and <Arc> via one of the sim's A:vars, such as engine torque, rpm, etc.
 
Yeah, I'm just realizing this, LoL. I've gone through all of the child properties for the "Alternate Font" in FSX/FS9 and it looks like FS9 will only pickup id=, FontSize=, FontWeight=, FontHeight=. where as FSX sp2/Acc will pick up the rest, id=, Charset=, FontFace=, FontSize=, FontFaceLocalize=, FontHeight=, FontWeight=, Bold=, Ital=.

It's interesting that FSX will pickup both 'Font=" and "FontFace=", but in FS9 will only pickup "Font=" and not "FontFace=". I'll just have to make separate gauges.
 
Actually, the id="xxx" is really only useful for human consumption. It has no real meaning vis-a-vis the XML drawing.

It's just a handy name you can use instead of a <!-- comment entry --> so you'll remember which entry is which... :rotfl:
 
Back
Top