|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: APIs to provide information about a font ID |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 //#include <coemain.h> |
|
23 |
|
24 #include "AknFontIdOffsets.hrh" |
|
25 #include "AknFontId.h" |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // ============================ MEMBER FUNCTIONS =============================== |
|
30 |
|
31 |
|
32 EXPORT_C TBool TAknFontId::IsEncodedFont(TInt aFontId) |
|
33 { |
|
34 const static TUint encodedMask = 0x80000000; // 1 bits starting at bit 31 = 1000.0000.0000.0000.0000.0000.0000.0000 |
|
35 return (aFontId & encodedMask) != 0; |
|
36 } |
|
37 |
|
38 TAknFontCategory TAknFontId::ExtractCategoryFromFontId(TInt aFontId) |
|
39 { |
|
40 const static TUint categoryMask = 0x0000000F; // 4 bits starting at bit 0 = 0000.0000.0000.0000.0000.0000.0000.1111 |
|
41 TInt category = 0; |
|
42 if(IsEncodedFont(aFontId)) |
|
43 { |
|
44 category = (aFontId & categoryMask); |
|
45 } |
|
46 return (TAknFontCategory)category; |
|
47 } |
|
48 |
|
49 TFontStrokeWeight TAknFontId::ExtractWeightFromFontId(TInt aFontId) |
|
50 { |
|
51 const static TUint weightMask = 0x00000010; // 1 bits starting at bit 4 = 0000.0000.0000.0000.0000.0000.0001.0000 |
|
52 TInt weight = 0; |
|
53 if(IsEncodedFont(aFontId)) |
|
54 { |
|
55 weight = (aFontId & weightMask) >> 4; |
|
56 } |
|
57 return (TFontStrokeWeight)weight; |
|
58 } |
|
59 |
|
60 TFontPosture TAknFontId::ExtractPostureFromFontId(TInt aFontId) |
|
61 { |
|
62 const static TUint postureMask = 0x00000020; // 1 bits starting at bit 5 = 0000.0000.0000.0000.0000.0000.0010.0000 |
|
63 TInt posture = 0; |
|
64 if(IsEncodedFont(aFontId)) |
|
65 { |
|
66 posture = (aFontId & postureMask) >> 5; |
|
67 } |
|
68 return (TFontPosture)posture; |
|
69 } |
|
70 |
|
71 TBool TAknFontId::ExtractOutlineFromFontId(TInt aFontId) |
|
72 { |
|
73 const static TUint outlineMask = 0x00000040; // 1 bits starting at bit 6 = 0000.0000.0000.0000.0000.0000.0100.0000 |
|
74 TInt outline = 0; |
|
75 if(IsEncodedFont(aFontId)) |
|
76 { |
|
77 outline = (aFontId & outlineMask) >> 6; |
|
78 } |
|
79 return (TBool)outline; |
|
80 } |
|
81 |
|
82 TInt TAknFontId::ExtractHeightFromFontId(TInt aFontId) |
|
83 { |
|
84 const static TUint heightMask = 0x7FE00000; // 10 bits starting at bit 21 = 0111.1111.1110.0000.0000.0000.0000.0000 |
|
85 TInt height = 0; |
|
86 if(IsEncodedFont(aFontId)) |
|
87 { |
|
88 height = (aFontId & heightMask) >> 21; |
|
89 } |
|
90 return height; |
|
91 } |
|
92 |
|
93 EXPORT_C TInt TAknFontId::FontIdForStartupNormalFont() |
|
94 { |
|
95 return 0x81000001; // Encodes a primary font with small, fixed size. Used for CEikonEnv::iNormalFont before a layout is available |
|
96 } |
|
97 // End of File |