This project has moved. For the latest updates, please go here.

CultureInfo in Telnet font

Topics: Developer Forum
Nov 10, 2008 at 7:50 PM
In order to avoid an exception in Telnet (I have a french Windows XP) ,I've made a small change in the "FontParser.cs" file.

You'll find below the new file version.

tags : "//Added"   and  "//Removed"

--------------------------------------------------

using

System;

 

using

System.Collections.Generic;

 

using

System.Text;

 

//Added

using

System.Globalization;

 

//End added

namespace

Terminals {

 

 

class FontParser {

 

 

public static System.Drawing.Font ParseFontName(string FontName) {

 

 

// FontName "[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3, GdiCharSet=0, GdiVerticalFont=False]" string

 

 

string Name="Microsoft Sans Serif";

 

 

float Size=8.25f;

 

 

string fn = FontName.Replace("[Font: ","");

 

fn = fn.Replace(

"]","").Trim();

 

 

string[] parts = fn.Split(',');

 

 

foreach (string p in parts) {

 

 

string[] fontItems = p.Split('=');

 

 

switch (fontItems[0].ToLower().Trim()) {

 

 

case "name":

 

Name = fontItems[1];

 

break;

 

 

case "size":

 

 

//Added

 

 

float.TryParse(fontItems[1], NumberStyles.Any, CultureInfo.InvariantCulture.NumberFormat, out Size);

 

 

//End added

 

 

//Removed float.TryParse(fontItems[1], out Size);

 

 

break;

 

}

}

System.Drawing.

Font f = new System.Drawing.Font(Name, Size);

 

 

 

return f;

 

}

}

}


----------------------- end ------------------------------
TryParse uses the "local" Decimal separator, so it don't works for me.

Keep up this good work online.
regards.
Coordinator
Dec 9, 2008 at 4:47 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.