Code needed for this font-icon atlas

isnorden

Amnesiac Modder
Joined
Jul 6, 2012
Messages
608
Location
Madison, Wisconsin, USA
Please forgive my cluelessness, but...this is the first time one of my mods has included new font icons. I've written the "plain" XML that locates the atlas and gives its size --

Spoiler :
Code:
<!-- Font icon data for new resources -->


<GameData>


	<IconFontTextures>
	
		<Row>
			<IconFontTexture>ICON_FONT_TEXTURE_NEWGEMS</IconFontTexture>
			<IconFontTextureFile>NewGemsFontIcons</IconFontTextureFile>
		</Row>
		
	</IconFontTextures>
	

	<IconFontMapping>
	
		<!-- Delete any font icons with the same name so there's no conflict. -->


		<Delete IconName="ICON_RES_AMBER" />
		<Delete IconName="ICON_RES_JADE" />
		<Delete IconName="ICON_RES_LAPIS" />

		<Row>
			<IconName>ICON_RES_AMBER</IconName>
			<IconFontTexture>ICON_FONT_TEXTURE_NEWGEMS</IconFontTexture>
			<IconMapping>1</IconMapping>
		</Row>

		<Row>
			<IconName>ICON_RES_JADE</IconName>
			<IconFontTexture>ICON_FONT_TEXTURE_NEWGEMS</IconFontTexture>
			<IconMapping>2</IconMapping>
		</Row>

		<Row>
			<IconName>ICON_RES_LAPIS</IconName>
			<IconFontTexture>ICON_FONT_TEXTURE_NEWGEMS</IconFontTexture>
			<IconMapping>3</IconMapping>
		</Row>

	</IconFontMapping>



</GameData>


Unfortunately, I have no idea of how to write the matching .ggxml file; could someone with more experience please post a code snippet here? (I'm attaching a GIF of the font-icon atlas as a guide.) Thank you very much!
 
Thanks -- I have one last question that wasn't in the original thread, though. The .dds file I created uses only the first three "icon cells" of a 4x4 grid (88x88 pixels). How do I mention unused spaces (if I do) in the code? Thank you for being patient with me.
 
You don't need to mention the empty cells, but the dimensions of the dds file MUST be correct in the <textures ...> tag
 
You've been very helpful; thank you so much! I assume the code below is correct, based on what you've said so far? Please let me know if I've made any mistakes ...


Spoiler :
Code:
<?xml version="1.0" encoding="UTF-8" ?>
<glyphgen>
  <textures width="88" height="88">
    <texture name="" src="NewGemsFontIcons.dds" allowcolor="1" alloweffects="1" inuse="1" />
  </textures>

  <styles count="1"><style name=""><layers count="1"><layer tex="" /></layers></style></styles>
  
  <glyphs count="3" fudgeadv="0" ascadj="-6" spacing="0" height="0" ascent="0" descent="0">
    <glyph ch="1" u="0" v="0" width="22" height="22" a="0" b="22" c="0" originx="0" originy="22" />
    <glyph ch="2" u="22" v="0" width="22" height="22" a="0" b="22" c="0" originx="0" originy="22" />
    <glyph ch="3" u="44" v="0" width="22" height="22" a="0" b="22" c="0" originx="0" originy="22" />
  </glyphs>

  <imports count="0"/>
  <toolonly>
    <metainfo pt="0.000000" width="256" height="256" alphabias="64" maxsize="256" bestfit="0" pow2="1" freetype="2" fontsrc="" />
    <glyphsets><set name="GlyphSetAscii" /></glyphsets>
  </toolonly>
</glyphgen>
 
Top Bottom