|
1 /* |
|
2 * Copyright (c) 2006-2009 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <s32file.h> |
|
20 #include <graphics/shapeimpl.h> |
|
21 #include "FNTSTORE.H" |
|
22 #include "OPENFONT.H" |
|
23 #include "FNTBODY.H" |
|
24 #include "FNTSTD.H" |
|
25 #include <graphics/shaperparams.h> |
|
26 #include "linkedfonts.h" |
|
27 #include "linkedfontsprivate.h" |
|
28 #include "openfontsprivate.h" |
|
29 #include "fbs.h" |
|
30 #include <openfontlinkedtypefaceelementspec.h> |
|
31 #include <graphics/openfontlinkedtypefacespecification.h> |
|
32 |
|
33 EXPORT_C CLinkedTypefaceSpecification* CLinkedTypefaceSpecification::NewLC(const TDesC& aTypefaceName) |
|
34 { |
|
35 CLinkedTypefaceSpecification* self = new (ELeave) CLinkedTypefaceSpecification(); |
|
36 CleanupStack::PushL(self); |
|
37 self->ConstructL(aTypefaceName); |
|
38 return self; |
|
39 } |
|
40 |
|
41 CLinkedTypefaceSpecification::CLinkedTypefaceSpecification() |
|
42 { |
|
43 } |
|
44 |
|
45 void CLinkedTypefaceSpecification::ConstructL(const TDesC &aTypefaceName) |
|
46 { |
|
47 iBody = new (ELeave) CLinkedTypefaceSpecificationBody(); |
|
48 |
|
49 TInt length = aTypefaceName.Length(); |
|
50 if ((length > KMaxTypefaceNameLength) || (length == 0)) |
|
51 User::Leave(KErrArgument); |
|
52 |
|
53 iBody->iLinkedTypefaceName = aTypefaceName.AllocL(); |
|
54 } |
|
55 |
|
56 EXPORT_C void CLinkedTypefaceSpecification::AddTypefaceAtIndexL(CLinkedTypefaceElementSpec& aElementSpec, TInt aIndex) |
|
57 { |
|
58 DoAddTypefaceL(aElementSpec, aIndex); |
|
59 } |
|
60 |
|
61 EXPORT_C void CLinkedTypefaceSpecification::AddTypefaceAtBackL(CLinkedTypefaceElementSpec& aElementSpec) |
|
62 { |
|
63 DoAddTypefaceL(aElementSpec, iBody->iTypefaces.Count()); |
|
64 } |
|
65 |
|
66 EXPORT_C TInt CLinkedTypefaceSpecification::RemoveTypeface(TInt aIndex) |
|
67 { |
|
68 if ( (aIndex < iBody->iTypefaces.Count()) && (aIndex >= 0) ) |
|
69 { |
|
70 CLinkedTypefaceElementSpec* elementSpec = iBody->iTypefaces[aIndex]; |
|
71 iBody->iTypefaces.Remove(aIndex); |
|
72 delete elementSpec; |
|
73 return KErrNone; |
|
74 } |
|
75 else |
|
76 return KErrNotFound; |
|
77 } |
|
78 |
|
79 EXPORT_C void CLinkedTypefaceSpecification::RegisterLinkedTypefaceL(CFbsTypefaceStore& aStore) |
|
80 { |
|
81 //Leave if there is no canonical element, or there are multiples. |
|
82 //The remaining validation must be performed in fntstore. |
|
83 User::LeaveIfError(CanonicalIndex()); |
|
84 User::LeaveIfError(aStore.RegisterLinkedTypeface(*this)); |
|
85 } |
|
86 |
|
87 EXPORT_C void CLinkedTypefaceSpecification::FetchLinkedTypefaceSpecificationL(CFbsTypefaceStore& aStore) |
|
88 { |
|
89 aStore.GetLinkedTypefaceL(*this); |
|
90 } |
|
91 |
|
92 EXPORT_C TInt CLinkedTypefaceSpecification::TypefaceCount() const |
|
93 { |
|
94 return iBody->iTypefaces.Count(); |
|
95 } |
|
96 |
|
97 EXPORT_C TPtrC CLinkedTypefaceSpecification::Name() const |
|
98 { |
|
99 return *iBody->iLinkedTypefaceName; |
|
100 } |
|
101 |
|
102 EXPORT_C CLinkedTypefaceSpecification::~CLinkedTypefaceSpecification() |
|
103 { |
|
104 delete iBody; |
|
105 } |
|
106 |
|
107 EXPORT_C TInt CLinkedTypefaceSpecification::CanonicalIndex() |
|
108 { |
|
109 TInt index = KErrNotFound; |
|
110 for (TInt i = iBody->iTypefaces.Count()-1 ; i >= 0; i--) |
|
111 { |
|
112 if (iBody->iTypefaces[i]->Canonical()) |
|
113 { |
|
114 if (index == KErrNotFound) |
|
115 index = i; |
|
116 else |
|
117 return KErrOverflow; |
|
118 } |
|
119 } |
|
120 return index; |
|
121 } |
|
122 |
|
123 EXPORT_C CLinkedTypefaceElementSpec* CLinkedTypefaceSpecification::Typeface(TInt aIndex) const |
|
124 { |
|
125 if ((aIndex >= iBody->iTypefaces.Count()) || (aIndex < 0)) |
|
126 { |
|
127 return NULL; |
|
128 } |
|
129 else |
|
130 { |
|
131 return iBody->iTypefaces[aIndex]; |
|
132 } |
|
133 } |
|
134 |
|
135 void CLinkedTypefaceSpecification::DoAddTypefaceL(CLinkedTypefaceElementSpec& aElementSpec, TInt aPos) |
|
136 { |
|
137 if (iBody->iTypefaces.Count() == KMaxLinkedTypefaces) |
|
138 User::Leave(KErrOverflow); |
|
139 |
|
140 TInt err = iBody->iTypefaces.Find(&aElementSpec); |
|
141 |
|
142 if (err != KErrNotFound) |
|
143 User::Leave(KErrAlreadyExists); |
|
144 |
|
145 if (aElementSpec.Canonical() && CanonicalIndex() != KErrNotFound) |
|
146 User::Leave(KErrArgument); |
|
147 |
|
148 if (GroupById(aElementSpec.GroupId()) == NULL) |
|
149 User::Leave(KErrArgument); |
|
150 |
|
151 TInt canIndex = CanonicalIndex(); |
|
152 if (aElementSpec.Canonical()) |
|
153 { |
|
154 if (canIndex!=KErrNotFound) |
|
155 User::Leave(KErrArgument); |
|
156 } |
|
157 |
|
158 err = iBody->iTypefaces.Insert(&aElementSpec, aPos); |
|
159 |
|
160 User::LeaveIfError(err); |
|
161 } |
|
162 |
|
163 EXPORT_C void CLinkedTypefaceSpecification::AddLinkedTypefaceGroupL(CLinkedTypefaceGroup& aGroup) |
|
164 { |
|
165 if (iBody->iGroups.Count() == KMaxLinkedTypefaceGroups) |
|
166 User::Leave(KErrOverflow); |
|
167 |
|
168 for (TInt i = iBody->iGroups.Count()-1 ; i >= 0 ; i--) |
|
169 { |
|
170 if (iBody->iGroups[i]->GroupId() == aGroup.GroupId()) |
|
171 User::Leave(KErrAlreadyExists); |
|
172 } |
|
173 iBody->iGroups.AppendL(&aGroup); |
|
174 } |
|
175 |
|
176 EXPORT_C TInt CLinkedTypefaceSpecification::RemoveLinkedTypefaceGroup(TInt aGroupId) |
|
177 { |
|
178 //Search for & remove the group if it exists |
|
179 CLinkedTypefaceGroup* remove = GroupById(aGroupId); |
|
180 //If the group has been found & removed remove all associated typefaces |
|
181 if (remove) |
|
182 { |
|
183 CLinkedTypefaceElementSpec* elementSpec; |
|
184 for (TInt i = iBody->iTypefaces.Count()-1 ; i >= 0 ; i--) |
|
185 { |
|
186 elementSpec = iBody->iTypefaces[i]; |
|
187 if (elementSpec->GroupId() == aGroupId) |
|
188 RemoveTypeface(i); |
|
189 } |
|
190 iBody->iGroups.Remove(iBody->iGroups.Find(remove)); |
|
191 delete remove; |
|
192 return KErrNone; |
|
193 } |
|
194 return KErrNotFound; |
|
195 } |
|
196 |
|
197 EXPORT_C CLinkedTypefaceGroup* CLinkedTypefaceSpecification::GroupById(TInt aGroupId) const |
|
198 { |
|
199 TInt index; |
|
200 TBool found = EFalse; |
|
201 for (index = iBody->iGroups.Count()-1; index != -1 ; index--) |
|
202 { |
|
203 if (iBody->iGroups[index]->GroupId() == aGroupId) |
|
204 { |
|
205 found = ETrue; |
|
206 break; |
|
207 } |
|
208 } |
|
209 |
|
210 if (found) |
|
211 return iBody->iGroups[index]; |
|
212 else |
|
213 return NULL; |
|
214 } |
|
215 |
|
216 EXPORT_C CLinkedTypefaceGroup* CLinkedTypefaceSpecification::Group(TInt aGroupIndex) const |
|
217 { |
|
218 if ( (aGroupIndex >= 0) && (aGroupIndex < iBody->iGroups.Count()) ) |
|
219 return iBody->iGroups[aGroupIndex]; |
|
220 else |
|
221 return NULL; |
|
222 } |
|
223 |
|
224 EXPORT_C TInt CLinkedTypefaceSpecification::GroupCount() const |
|
225 { |
|
226 return iBody->iGroups.Count(); |
|
227 } |
|
228 |
|
229 EXPORT_C void CLinkedTypefaceSpecification::Clear() |
|
230 { |
|
231 iBody->iGroups.ResetAndDestroy(); |
|
232 iBody->iTypefaces.ResetAndDestroy(); |
|
233 } |
|
234 |
|
235 EXPORT_C void CLinkedTypefaceSpecification::UpdateLinkedTypefaceL(CFbsTypefaceStore& aStore) |
|
236 { |
|
237 User::LeaveIfError(aStore.UpdateLinkedTypeface(*this)); |
|
238 } |
|
239 |
|
240 CLinkedTypefaceSpecificationBody::CLinkedTypefaceSpecificationBody() |
|
241 { |
|
242 } |
|
243 |
|
244 CLinkedTypefaceSpecificationBody::~CLinkedTypefaceSpecificationBody() |
|
245 { |
|
246 delete iLinkedTypefaceName; |
|
247 iTypefaces.ResetAndDestroy(); |
|
248 iGroups.ResetAndDestroy(); |
|
249 } |
|
250 |
|
251 EXPORT_C CLinkedTypefaceElementSpec* CLinkedTypefaceElementSpec::NewLC(const TDesC& aElementName, TInt aGroupId) |
|
252 { |
|
253 CLinkedTypefaceElementSpec* self = new(ELeave)CLinkedTypefaceElementSpec(aGroupId); |
|
254 CleanupStack::PushL(self); |
|
255 self->ConstructL(aElementName); |
|
256 return self; |
|
257 } |
|
258 |
|
259 EXPORT_C CLinkedTypefaceElementSpec::~CLinkedTypefaceElementSpec() |
|
260 { |
|
261 delete iElementName; |
|
262 } |
|
263 |
|
264 EXPORT_C TPtrC CLinkedTypefaceElementSpec::ElementName() const |
|
265 { |
|
266 return *iElementName; |
|
267 } |
|
268 |
|
269 EXPORT_C void CLinkedTypefaceElementSpec::SetCanonical(TBool aIsCanonical) |
|
270 { |
|
271 iIsCanonical = aIsCanonical; |
|
272 } |
|
273 |
|
274 EXPORT_C TBool CLinkedTypefaceElementSpec::Canonical() const |
|
275 { |
|
276 return iIsCanonical; |
|
277 } |
|
278 |
|
279 CLinkedTypefaceElementSpec::CLinkedTypefaceElementSpec(TInt aGroupId) |
|
280 { |
|
281 iGroupId = aGroupId; |
|
282 iIsCanonical = EFalse; |
|
283 } |
|
284 |
|
285 EXPORT_C TInt CLinkedTypefaceElementSpec::GroupId() const |
|
286 { |
|
287 return iGroupId; |
|
288 } |
|
289 |
|
290 EXPORT_C COpenFontLinkedTypefaceSpecification* COpenFontLinkedTypefaceSpecification::NewLC(const TDesC& aTypefaceName) |
|
291 { |
|
292 COpenFontLinkedTypefaceSpecification* self = new (ELeave) COpenFontLinkedTypefaceSpecification(); |
|
293 CleanupStack::PushL(self); |
|
294 self->ConstructL(aTypefaceName); |
|
295 return self; |
|
296 } |
|
297 |
|
298 EXPORT_C COpenFontLinkedTypefaceSpecification* COpenFontLinkedTypefaceSpecification::NewLC(const TLinkedTypefaceSpecificationArgs& aSpecArgs) |
|
299 { |
|
300 COpenFontLinkedTypefaceSpecification* self = new (ELeave) COpenFontLinkedTypefaceSpecification(); |
|
301 CleanupStack::PushL(self); |
|
302 self->ConstructL(aSpecArgs); |
|
303 return self; |
|
304 } |
|
305 |
|
306 COpenFontLinkedTypefaceSpecification::COpenFontLinkedTypefaceSpecification() |
|
307 { |
|
308 } |
|
309 |
|
310 void COpenFontLinkedTypefaceSpecification::ConstructL(const TDesC &aTypefaceName) |
|
311 { |
|
312 TInt length = aTypefaceName.Length(); |
|
313 if ((length > KMaxTypefaceNameLength) || (length == 0)) |
|
314 User::Leave(KErrArgument); |
|
315 |
|
316 iLinkedTypefaceName = aTypefaceName.AllocL(); |
|
317 } |
|
318 |
|
319 void COpenFontLinkedTypefaceSpecification::ConstructL(const TLinkedTypefaceSpecificationArgs& aSpecArgs) |
|
320 { |
|
321 iLinkedTypefaceName = aSpecArgs.iName.AllocL(); |
|
322 |
|
323 TInt i; |
|
324 |
|
325 for (i = 0; i != aSpecArgs.iGroupSize ; i++) |
|
326 { |
|
327 CLinkedTypefaceGroup* grp = CLinkedTypefaceGroup::NewLC(aSpecArgs.iGroups[i].iGroupId); |
|
328 grp->SetBaselineShift(aSpecArgs.iGroups[i].iBaselineShift); |
|
329 grp->SetBoldnessPercentage(aSpecArgs.iGroups[i].iBoldnessPercentage); |
|
330 grp->SetItalicAngle(aSpecArgs.iGroups[i].iItalicAngle); |
|
331 grp->SetScalingOption(aSpecArgs.iGroups[i].iScalingOption); |
|
332 AddLinkedTypefaceGroupL(*grp); |
|
333 CleanupStack::Pop(grp); |
|
334 } |
|
335 |
|
336 for (i = 0 ; i != aSpecArgs.iSize ; i++) |
|
337 { |
|
338 COpenFontLinkedTypefaceElementSpec* es = COpenFontLinkedTypefaceElementSpec::NewLC(aSpecArgs.iTypefaces[i].iName, aSpecArgs.iTypefaces[i].iGroupId); |
|
339 es->SetCanonical(aSpecArgs.iTypefaces[i].iIsCanonical); |
|
340 AddTypefaceAtBackL(*es); |
|
341 CleanupStack::Pop(es); |
|
342 } |
|
343 |
|
344 //ASSERT Can. Indexs match. |
|
345 } |
|
346 |
|
347 EXPORT_C COpenFontLinkedTypefaceSpecification::~COpenFontLinkedTypefaceSpecification() |
|
348 { |
|
349 delete iLinkedTypefaceName; |
|
350 iTypefaces.ResetAndDestroy(); |
|
351 iTypefaces.Close(); |
|
352 iGroups.ResetAndDestroy(); |
|
353 iGroups.Close(); |
|
354 } |
|
355 |
|
356 EXPORT_C void COpenFontLinkedTypefaceSpecification::AddTypefaceAtIndexL(COpenFontLinkedTypefaceElementSpec& aElementSpec, TInt aIndex) |
|
357 { |
|
358 DoAddTypefaceL(aElementSpec, aIndex); |
|
359 } |
|
360 |
|
361 EXPORT_C void COpenFontLinkedTypefaceSpecification::AddTypefaceAtBackL(COpenFontLinkedTypefaceElementSpec& aElementSpec) |
|
362 { |
|
363 DoAddTypefaceL(aElementSpec, iTypefaces.Count()); |
|
364 } |
|
365 |
|
366 EXPORT_C TInt COpenFontLinkedTypefaceSpecification::RemoveTypeface(TInt aIndex) |
|
367 { |
|
368 if ( (aIndex < iTypefaces.Count()) && (aIndex >= 0) ) |
|
369 { |
|
370 COpenFontLinkedTypefaceElementSpec* elementSpec = iTypefaces[aIndex]; |
|
371 iTypefaces.Remove(aIndex); |
|
372 |
|
373 delete elementSpec; |
|
374 return KErrNone; |
|
375 } |
|
376 else |
|
377 return KErrNotFound; |
|
378 } |
|
379 |
|
380 EXPORT_C TInt COpenFontLinkedTypefaceSpecification::TypefaceCount() const |
|
381 { |
|
382 return iTypefaces.Count(); |
|
383 } |
|
384 |
|
385 EXPORT_C TPtrC COpenFontLinkedTypefaceSpecification::Name() const |
|
386 { |
|
387 return *iLinkedTypefaceName; |
|
388 } |
|
389 |
|
390 EXPORT_C TInt COpenFontLinkedTypefaceSpecification::CanonicalIndex() const |
|
391 { |
|
392 TInt index = KErrNotFound; |
|
393 for (TInt i = iTypefaces.Count()-1 ; i >= 0; i--) |
|
394 { |
|
395 if (iTypefaces[i]->Canonical()) |
|
396 { |
|
397 if (index == KErrNotFound) |
|
398 index = i; |
|
399 else |
|
400 return KErrOverflow; |
|
401 } |
|
402 } |
|
403 return index; |
|
404 } |
|
405 |
|
406 EXPORT_C COpenFontLinkedTypefaceElementSpec* COpenFontLinkedTypefaceSpecification::Typeface(TInt aIndex) const |
|
407 { |
|
408 if ((aIndex >= iTypefaces.Count()) || (aIndex < 0)) |
|
409 { |
|
410 return NULL; |
|
411 } |
|
412 else |
|
413 { |
|
414 return iTypefaces[aIndex]; |
|
415 } |
|
416 } |
|
417 |
|
418 void COpenFontLinkedTypefaceSpecification::DoAddTypefaceL(COpenFontLinkedTypefaceElementSpec& aElementSpec, TInt aPos) |
|
419 { |
|
420 if (iTypefaces.Count() == KMaxLinkedTypefaces) |
|
421 User::Leave(KErrOverflow); |
|
422 |
|
423 TInt err = iTypefaces.Find(&aElementSpec); |
|
424 |
|
425 if (err != KErrNotFound) |
|
426 User::Leave(KErrAlreadyExists); |
|
427 |
|
428 if (aElementSpec.Canonical() && CanonicalIndex() >= 0) |
|
429 User::Leave(KErrArgument); |
|
430 |
|
431 if (GroupById(aElementSpec.GroupId()) == NULL) |
|
432 User::Leave(KErrArgument); |
|
433 |
|
434 err = iTypefaces.Insert(&aElementSpec, aPos); |
|
435 |
|
436 User::LeaveIfError(err); |
|
437 } |
|
438 |
|
439 EXPORT_C void COpenFontLinkedTypefaceSpecification::AddLinkedTypefaceGroupL(CLinkedTypefaceGroup& aGroup) |
|
440 { |
|
441 if (iGroups.Count() == KMaxLinkedTypefaceGroups) |
|
442 User::Leave(KErrOverflow); |
|
443 |
|
444 for (TInt i = iGroups.Count()-1 ; i >= 0 ; i--) |
|
445 { |
|
446 if (iGroups[i]->GroupId() == aGroup.GroupId()) |
|
447 User::Leave(KErrAlreadyExists); |
|
448 } |
|
449 iGroups.AppendL(&aGroup); |
|
450 } |
|
451 |
|
452 EXPORT_C TInt COpenFontLinkedTypefaceSpecification::RemoveLinkedTypefaceGroup(TInt aGroupId) |
|
453 { |
|
454 //Search for & remove the group if it exists |
|
455 CLinkedTypefaceGroup* remove = GroupById(aGroupId); |
|
456 //If the group has been found & removed remove all associated typefaces |
|
457 if (remove) |
|
458 { |
|
459 COpenFontLinkedTypefaceElementSpec* elementSpec; |
|
460 for (TInt i = iTypefaces.Count()-1 ; i >= 0 ; i--) |
|
461 { |
|
462 elementSpec = iTypefaces[i]; |
|
463 if (elementSpec->GroupId() == aGroupId) |
|
464 RemoveTypeface(i); |
|
465 } |
|
466 iGroups.Remove(iGroups.Find(remove)); |
|
467 delete remove; |
|
468 return KErrNone; |
|
469 } |
|
470 return KErrNotFound; |
|
471 } |
|
472 |
|
473 EXPORT_C CLinkedTypefaceGroup* COpenFontLinkedTypefaceSpecification::GroupById(TInt aGroupId) const |
|
474 { |
|
475 TInt index; |
|
476 TBool found = EFalse; |
|
477 for (index = iGroups.Count()-1; index != -1 ; index--) |
|
478 { |
|
479 if (iGroups[index]->GroupId() == aGroupId) |
|
480 { |
|
481 found = ETrue; |
|
482 break; |
|
483 } |
|
484 } |
|
485 |
|
486 if (found) |
|
487 return iGroups[index]; |
|
488 else |
|
489 return NULL; |
|
490 } |
|
491 |
|
492 EXPORT_C const CLinkedTypefaceGroup* COpenFontLinkedTypefaceSpecification::Group(TInt aGroupIndex) const |
|
493 { |
|
494 if ( (aGroupIndex >= 0) && (aGroupIndex < iGroups.Count()) ) |
|
495 return iGroups[aGroupIndex]; |
|
496 else |
|
497 return NULL; |
|
498 } |
|
499 |
|
500 EXPORT_C TInt COpenFontLinkedTypefaceSpecification::GroupCount() const |
|
501 { |
|
502 return iGroups.Count(); |
|
503 } |
|
504 |
|
505 COpenFontLinkedTypefaceSpecificationBody::COpenFontLinkedTypefaceSpecificationBody() |
|
506 { |
|
507 } |
|
508 |
|
509 // destructor |
|
510 COpenFontLinkedTypefaceSpecificationBody::~COpenFontLinkedTypefaceSpecificationBody() |
|
511 { |
|
512 delete iLinkedTypefaceName; |
|
513 iTypefaces.Reset(); |
|
514 } |
|
515 |
|
516 EXPORT_C COpenFontLinkedTypefaceElementSpec* COpenFontLinkedTypefaceElementSpec::NewLC(const TDesC& aElementName, TInt aGroupId) |
|
517 { |
|
518 COpenFontLinkedTypefaceElementSpec* self = new(ELeave)COpenFontLinkedTypefaceElementSpec(aGroupId); |
|
519 CleanupStack::PushL(self); |
|
520 self->ConstructL(aElementName); |
|
521 return self; |
|
522 } |
|
523 |
|
524 EXPORT_C COpenFontLinkedTypefaceElementSpec::~COpenFontLinkedTypefaceElementSpec() |
|
525 { |
|
526 delete iElementName; |
|
527 delete iFileName; |
|
528 } |
|
529 |
|
530 EXPORT_C TPtrC COpenFontLinkedTypefaceElementSpec::ElementName() const |
|
531 { |
|
532 return *iElementName; |
|
533 } |
|
534 |
|
535 EXPORT_C void COpenFontLinkedTypefaceElementSpec::SetCanonical(TBool aIsCanonical) |
|
536 { |
|
537 iIsCanonical = aIsCanonical; |
|
538 } |
|
539 |
|
540 EXPORT_C TBool COpenFontLinkedTypefaceElementSpec::Canonical() const |
|
541 { |
|
542 return iIsCanonical; |
|
543 } |
|
544 |
|
545 EXPORT_C TInt COpenFontLinkedTypefaceElementSpec::GroupId() const |
|
546 { |
|
547 return iGroupId; |
|
548 } |
|
549 |
|
550 EXPORT_C TPtrC COpenFontLinkedTypefaceElementSpec::FileName() const |
|
551 { |
|
552 return *iFileName; |
|
553 } |
|
554 |
|
555 EXPORT_C void COpenFontLinkedTypefaceElementSpec::SetFileNameL(const TDesC& aFileName) |
|
556 { |
|
557 iFileName = aFileName.AllocL(); |
|
558 } |
|
559 |
|
560 COpenFontLinkedTypefaceElementSpec::COpenFontLinkedTypefaceElementSpec(TInt aGroupId) |
|
561 { |
|
562 iGroupId = aGroupId; |
|
563 } |
|
564 |
|
565 void COpenFontLinkedTypefaceElementSpec::ConstructL(const TDesC& aName) |
|
566 { |
|
567 TInt length = aName.Length(); |
|
568 if ((length == 0) || (length > KMaxTypefaceNameLength)) |
|
569 User::Leave(KErrArgument); |
|
570 iElementName = aName.AllocL(); |
|
571 } |
|
572 |
|
573 void CLinkedTypefaceElementSpec::ConstructL(const TDesC& aName) |
|
574 { |
|
575 TInt length = aName.Length(); |
|
576 if ((length == 0) || (length > KMaxTypefaceNameLength)) |
|
577 User::Leave(KErrArgument); |
|
578 iElementName = aName.AllocL(); |
|
579 } |
|
580 |
|
581 EXPORT_C CLinkedTypefaceGroup* CLinkedTypefaceGroup::NewLC(TInt aGroupId) |
|
582 { |
|
583 CLinkedTypefaceGroup* self = new (ELeave) CLinkedTypefaceGroup(aGroupId); |
|
584 CleanupStack::PushL(self); |
|
585 return self; |
|
586 } |
|
587 |
|
588 CLinkedTypefaceGroup::CLinkedTypefaceGroup(TInt aGroupId) |
|
589 { |
|
590 iGroupId = aGroupId; |
|
591 iScalingOption = EScalingNone; |
|
592 iBaselineShift = ENoBaselineShift; |
|
593 iBoldnessPercentage = -1; |
|
594 iItalicAngle = -1; |
|
595 } |
|
596 |
|
597 CLinkedTypefaceGroup::~CLinkedTypefaceGroup() |
|
598 { |
|
599 } |
|
600 |
|
601 EXPORT_C void CLinkedTypefaceGroup::SetScalingOption(CLinkedTypefaceGroup::TScalingOption aOption) |
|
602 { |
|
603 iScalingOption = aOption; |
|
604 } |
|
605 |
|
606 EXPORT_C CLinkedTypefaceGroup::TScalingOption CLinkedTypefaceGroup::ScalingOption() const |
|
607 { |
|
608 return iScalingOption; |
|
609 } |
|
610 |
|
611 EXPORT_C void CLinkedTypefaceGroup::SetBaselineShift(CLinkedTypefaceGroup::TBaselineShift aShift) |
|
612 { |
|
613 iBaselineShift = aShift; |
|
614 } |
|
615 |
|
616 EXPORT_C CLinkedTypefaceGroup::TBaselineShift CLinkedTypefaceGroup::BaselineShift() const |
|
617 { |
|
618 return iBaselineShift; |
|
619 } |
|
620 |
|
621 EXPORT_C void CLinkedTypefaceGroup::SetBoldnessPercentage(TInt aPercentage) |
|
622 { |
|
623 iBoldnessPercentage = aPercentage; |
|
624 } |
|
625 |
|
626 EXPORT_C TInt CLinkedTypefaceGroup::BoldnessPercentage() const |
|
627 { |
|
628 return iBoldnessPercentage; |
|
629 } |
|
630 |
|
631 EXPORT_C TInt CLinkedTypefaceGroup::GroupId() const |
|
632 { |
|
633 return iGroupId; |
|
634 } |
|
635 |
|
636 EXPORT_C TInt CLinkedTypefaceGroup::ItalicAngle() const |
|
637 { |
|
638 return iItalicAngle; |
|
639 } |
|
640 |
|
641 EXPORT_C void CLinkedTypefaceGroup::SetItalicAngle(TInt aAngle) |
|
642 { |
|
643 iItalicAngle = aAngle; |
|
644 } |
|
645 |
|
646 EXPORT_C void TLinkedTypefaceSpecificationArgs::operator =(const CLinkedTypefaceSpecification& aRhs) |
|
647 { |
|
648 iSize = aRhs.TypefaceCount(); |
|
649 iGroupSize = aRhs.GroupCount(); |
|
650 iName = aRhs.Name(); |
|
651 |
|
652 TInt i; |
|
653 for (i = 0 ; i != iSize ; i++) |
|
654 iTypefaces[i] = aRhs.Typeface(i); |
|
655 |
|
656 for (i = 0 ; i != iGroupSize ; i++) |
|
657 iGroups[i] = aRhs.Group(i); |
|
658 } |
|
659 |
|
660 EXPORT_C void TLinkedTypefaceSpecificationArgs::operator =(const COpenFontLinkedTypefaceSpecification &aRhs) |
|
661 { |
|
662 iSize = aRhs.TypefaceCount(); |
|
663 iGroupSize = aRhs.GroupCount(); |
|
664 iName = aRhs.Name(); |
|
665 |
|
666 TInt i; |
|
667 for (i = 0 ; i != iSize ; i++) |
|
668 iTypefaces[i] = aRhs.Typeface(i); |
|
669 |
|
670 for (i = 0 ; i != iGroupSize ; i++) |
|
671 iGroups[i] = aRhs.Group(i); |
|
672 } |
|
673 |
|
674 void TLinkedTypefaceElementSpecArgs::operator = (const CLinkedTypefaceElementSpec* aRhs) |
|
675 { |
|
676 iIsCanonical = aRhs->Canonical(); |
|
677 iGroupId = aRhs->GroupId(); |
|
678 iName = aRhs->ElementName(); |
|
679 } |
|
680 |
|
681 void TLinkedTypefaceElementSpecArgs::operator = (const COpenFontLinkedTypefaceElementSpec* aRhs) |
|
682 { |
|
683 iIsCanonical = aRhs->Canonical(); |
|
684 iGroupId = aRhs->GroupId(); |
|
685 iName = aRhs->ElementName(); |
|
686 } |
|
687 |
|
688 void TLinkedTypefaceGroupArgs::operator =(const CLinkedTypefaceGroup* aRhs) |
|
689 { |
|
690 iGroupId = aRhs->GroupId(); |
|
691 iScalingOption = aRhs->ScalingOption(); |
|
692 iBaselineShift = aRhs->BaselineShift(); |
|
693 iBoldnessPercentage = aRhs->BoldnessPercentage(); |
|
694 iItalicAngle = aRhs->ItalicAngle(); |
|
695 } |