.net Labels display text wrong


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: .net Labels display text wrong

  1. #1
    Join Date
    Sep 2004
    Posts
    3

    Exclamation .net Labels display text wrong

    Help!
    Major disgruntlement.


    Conditions:
    using a true type font that's symbolic/graphic like wingdings
    the ttfont only has 20 characters mapped to the symbols/images
    the rest are unmapped.

    Results:

    in vb6, eg, a label would correctly display the ttfont as the symbols for characters in the right range that were typed into the caption while correctly displaying blanks for all other characters.
    if A-Z was mapped to a symbol, any char between A-Z should show a symbol and any other char such as 0,1,a,b,c should show a blank.

    in .net, the label correctly shows symbols for A-Z but incorrectly shows the default sanserif character where no symbol was mapped. Setting label text to 01abc will display exactly that 01abc, not blanks as it should.

    anyone have a clue how to get proper label behavior back again?

    (vb.net is a deception...Not vb More like java)

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Could you use a regular expression to replace non-alphabetic characters with spaces?

    Dim RegEx As New System.Text.RegularExpressions.Regex("[^A-Za-z]")
    Label.Text = RegEx.Replace(sText, " ")
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Sep 2004
    Posts
    3
    Thanx Phil,

    Unfortunately, there is no way to know ahead of time which characters are mapped and which pick up a default. I have to deal with 8 or more ttfonts symbolic/graphic, all using some to many of the first 128 characters with blanks before and after the mapped groups.

    The 2nd 128 are all blank so that's easy to deal with. In the future they may expand into the 2nd 128.

    SO, I need an expert in fonts, use of textmetrics or whatever to find a way to read back each character slot (index?) in the ttfont and determine if it is a mapped graphic or custom vector, or assigned something representing a default character set (ms san serif). This has me pulling my hair out! Maybe gdi32 has something but i haven't spotted it yet. Just started using vb.net a few weeks ago.

    Bob Phillips

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center