Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to check character codes for space and newline symbols using Symbian C++

From Wiki
Jump to: navigation, search



Article Metadata
Compatibility
Platform(s): S60 1st Edition
S60 2nd Edition
S60 2nd Edition, FP1
S60 2nd Edition, FP2
S60 2nd Edition, FP3
S60 2nd Edition (initial release)
S60 1st Edition
Article
Created: User:Technical writer 2 (24 May 2005)
Last edited: hamishwillee (14 Jun 2012)

Overview

What are the present codes for space and linefeed characters? How can I be sure of which code works with each device?

Description

On S60 2nd Edition, Feature Pack 1 and earlier, the following codes (hex values) are used for linefeed and space symbols:
Linefeed:  0xe125
Space:     0xe118
Starting from S60 2nd Edition, FP2 and the Nokia 6630, these character codes have been changed to be the following:
Linefeed:  0xf200
Space:     0xf201

Solution

It is possible to dynamically check what codes to use by checking if the current font includes these characters. The following example code demonstrates this.
#include <fbs.h>
#include <openfont.h>
TUid fontUid = CEikonEnv::Static()->NormalFont()->TypeUid();
if(fontUid == KCFbsFontUid)
    {
    const CFbsFont* font =
      static_cast<const CFbsFont*>(CEikonEnv::Static()->NormalFont());
    TOpenFontCharMetrics metrics;
    const TUint8 *bitmap1, *bitmap2;
    TSize size;
    font->GetCharacterData(0xe118,metrics,bitmap1,size);
    font->GetCharacterData(0xe125,metrics,bitmap2,size);
    if(bitmap1 == bitmap2)
        {
        // glyph bitmap pointers for space + lf have
        // the same value, pointing to the same 'undefined'
        // bitmap -> Font does not have these chars
        // Switch to using 0xF200 and 0xF201 as lf/space codes
        }   
    }

This page was last modified on 14 June 2012, at 04:57.
43 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×