• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * %W% %E%
3  *
4  * (C) Copyright IBM Corp. 1998-2003 - All Rights Reserved
5  *
6  */
7 
8 #include "LETypes.h"
9 #include "OpenTypeTables.h"
10 #include "OpenTypeUtilities.h"
11 #include "ScriptAndLanguage.h"
12 #include "LESwaps.h"
13 
14 U_NAMESPACE_BEGIN
15 
findLanguage(LETag languageTag,le_bool exactMatch) const16 const LangSysTable *ScriptTable::findLanguage(LETag languageTag, le_bool exactMatch) const
17 {
18     le_uint16 count = SWAPW(langSysCount);
19     Offset langSysTableOffset = exactMatch? 0 : SWAPW(defaultLangSysTableOffset);
20 
21     if (count > 0) {
22         Offset foundOffset =
23             OpenTypeUtilities::getTagOffset(languageTag, langSysRecordArray, count);
24 
25         if (foundOffset != 0) {
26             langSysTableOffset = foundOffset;
27         }
28     }
29 
30     if (langSysTableOffset != 0) {
31         return (const LangSysTable *) ((char *)this + langSysTableOffset);
32     }
33 
34     return 0;
35 }
36 
findScript(LETag scriptTag) const37 const ScriptTable *ScriptListTable::findScript(LETag scriptTag) const
38 {
39     le_uint16 count = SWAPW(scriptCount);
40     Offset scriptTableOffset =
41         OpenTypeUtilities::getTagOffset(scriptTag, scriptRecordArray, count);
42 
43     if (scriptTableOffset != 0) {
44         return (const ScriptTable *) ((char *)this + scriptTableOffset);
45     }
46 
47     return 0;
48 }
49 
findLanguage(LETag scriptTag,LETag languageTag,le_bool exactMatch) const50 const LangSysTable *ScriptListTable::findLanguage(LETag scriptTag, LETag languageTag, le_bool exactMatch) const
51 {
52     const ScriptTable *scriptTable = findScript(scriptTag);
53 
54     if (scriptTable == 0) {
55         return 0;
56     }
57 
58     return scriptTable->findLanguage(languageTag, exactMatch);
59 }
60 
61 U_NAMESPACE_END
62