ReactOS  0.4.15-dev-1187-g119f102
usp10.c File Reference
#include <stdarg.h>
#include <stdlib.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "usp10.h"
#include "usp10_internal.h"
#include "wine/debug.h"
#include "wine/heap.h"
Include dependency graph for usp10.c:

Go to the source code of this file.

Classes

struct  usp10_script_range
 
struct  StringGlyphs
 
struct  StringAnalysis
 
struct  FindGlyph_struct
 

Macros

#define Numeric_space   0x0020
 
#define ZWSP   0x200B
 
#define ZWNJ   0x200C
 
#define ZWJ   0x200D
 

Enumerations

enum  stringanalysis_flags { SCRIPT_STRING_ANALYSIS_FLAGS_SIZE = 0x1, SCRIPT_STRING_ANALYSIS_FLAGS_INVALID = 0x2 }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (uniscribe)
 
BOOL usp10_array_reserve (void **elements, SIZE_T *capacity, SIZE_T count, SIZE_T size)
 
static BOOL set_cache_font_properties (const HDC hdc, ScriptCache *sc)
 
static void get_cache_font_properties (SCRIPT_FONTPROPERTIES *sfp, ScriptCache *sc)
 
static LONG get_cache_height (SCRIPT_CACHE *psc)
 
static BYTE get_cache_pitch_family (SCRIPT_CACHE *psc)
 
static WORD get_cache_glyph (SCRIPT_CACHE *psc, DWORD c)
 
static WORD set_cache_glyph (SCRIPT_CACHE *psc, WCHAR c, WORD glyph)
 
static BOOL get_cache_glyph_widths (SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
 
static BOOL set_cache_glyph_widths (SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
 
static HRESULT init_script_cache (const HDC hdc, SCRIPT_CACHE *psc)
 
static WCHAR mirror_char (WCHAR ch)
 
static DWORD decode_surrogate_pair (const WCHAR *str, unsigned int index, unsigned int end)
 
static int __cdecl usp10_compare_script_range (const void *key, const void *value)
 
static enum usp10_script get_char_script (const WCHAR *str, unsigned int index, unsigned int end, unsigned int *consumed)
 
static int __cdecl compare_FindGlyph (const void *a, const void *b)
 
int USP10_FindGlyphInLogClust (const WORD *pwLogClust, int cChars, WORD target)
 
HRESULT WINAPI ScriptFreeCache (SCRIPT_CACHE *psc)
 
HRESULT WINAPI ScriptGetProperties (const SCRIPT_PROPERTIES ***props, int *num)
 
HRESULT WINAPI ScriptGetFontProperties (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPROPERTIES *sfp)
 
HRESULT WINAPI ScriptRecordDigitSubstitution (LCID locale, SCRIPT_DIGITSUBSTITUTE *sds)
 
HRESULT WINAPI ScriptApplyDigitSubstitution (const SCRIPT_DIGITSUBSTITUTE *sds, SCRIPT_CONTROL *sc, SCRIPT_STATE *ss)
 
static BOOL is_indic (enum usp10_script script)
 
static enum usp10_script base_indic (enum usp10_script script)
 
static BOOL script_is_numeric (enum usp10_script script)
 
static HRESULT _ItemizeInternal (const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, OPENTYPE_TAG *pScriptTags, int *pcItems)
 
HRESULT WINAPI ScriptItemizeOpenType (const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, OPENTYPE_TAG *pScriptTags, int *pcItems)
 
HRESULT WINAPI ScriptItemize (const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, int *pcItems)
 
static int getGivenTabWidth (ScriptCache *psc, SCRIPT_TABDEF *pTabdef, int charPos, int current_x)
 
static BOOL requires_fallback (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, const WCHAR *pwcInChars, int cChars)
 
static void find_fallback_font (enum usp10_script scriptid, WCHAR *FaceName)
 
HRESULT WINAPI ScriptStringAnalyse (HDC hdc, const void *pString, int cString, int cGlyphs, int iCharset, DWORD dwFlags, int iReqWidth, SCRIPT_CONTROL *psControl, SCRIPT_STATE *psState, const int *piDx, SCRIPT_TABDEF *pTabdef, const BYTE *pbInClass, SCRIPT_STRING_ANALYSIS *pssa)
 
static BOOL does_glyph_start_cluster (const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cChars, int glyph, int direction)
 
static HRESULT SS_ItemOut (SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, int iItem, int cStart, int cEnd, UINT uOptions, const RECT *prc, BOOL fSelected, BOOL fDisabled)
 
HRESULT WINAPI ScriptStringOut (SCRIPT_STRING_ANALYSIS ssa, int iX, int iY, UINT uOptions, const RECT *prc, int iMinSel, int iMaxSel, BOOL fDisabled)
 
HRESULT WINAPI ScriptStringCPtoX (SCRIPT_STRING_ANALYSIS ssa, int icp, BOOL fTrailing, int *pX)
 
HRESULT WINAPI ScriptStringXtoCP (SCRIPT_STRING_ANALYSIS ssa, int iX, int *piCh, int *piTrailing)
 
HRESULT WINAPI ScriptStringFree (SCRIPT_STRING_ANALYSIS *pssa)
 
static int get_cluster_size (const WORD *pwLogClust, int cChars, int item, int direction, int *iCluster, int *check_out)
 
static int get_glyph_cluster_advance (const int *piAdvance, const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cGlyphs, int cChars, int glyph, int direction)
 
HRESULT WINAPI ScriptCPtoX (int iCP, BOOL fTrailing, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piX)
 
static BOOL get_cluster_data (const WORD *pwLogClust, int cChars, int cluster_index, int *cluster_size, int *start_index)
 
static int get_cluster_advance (const int *piAdvance, const SCRIPT_VISATTR *psva, const WORD *pwLogClust, int cGlyphs, int cChars, int cluster, int direction)
 
HRESULT WINAPI ScriptXtoCP (int iX, int cChars, int cGlyphs, const WORD *pwLogClust, const SCRIPT_VISATTR *psva, const int *piAdvance, const SCRIPT_ANALYSIS *psa, int *piCP, int *piTrailing)
 
HRESULT WINAPI ScriptBreak (const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
 
HRESULT WINAPI ScriptIsComplex (const WCHAR *chars, int len, DWORD flag)
 
HRESULT WINAPI ScriptShapeOpenType (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, WORD *pwOutGlyphs, SCRIPT_GLYPHPROP *pOutGlyphProps, int *pcGlyphs)
 
HRESULT WINAPI ScriptShape (HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, SCRIPT_ANALYSIS *psa, WORD *pwOutGlyphs, WORD *pwLogClust, SCRIPT_VISATTR *psva, int *pcGlyphs)
 
HRESULT WINAPI ScriptPlaceOpenType (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, int cChars, const WORD *pwGlyphs, const SCRIPT_GLYPHPROP *pGlyphProps, int cGlyphs, int *piAdvance, GOFFSET *pGoffset, ABC *pABC)
 
HRESULT WINAPI ScriptPlace (HDC hdc, SCRIPT_CACHE *psc, const WORD *pwGlyphs, int cGlyphs, const SCRIPT_VISATTR *psva, SCRIPT_ANALYSIS *psa, int *piAdvance, GOFFSET *pGoffset, ABC *pABC)
 
HRESULT WINAPI ScriptGetCMap (HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs)
 
HRESULT WINAPI ScriptTextOut (const HDC hdc, SCRIPT_CACHE *psc, int x, int y, UINT fuOptions, const RECT *lprc, const SCRIPT_ANALYSIS *psa, const WCHAR *pwcReserved, int iReserved, const WORD *pwGlyphs, int cGlyphs, const int *piAdvance, const int *piJustify, const GOFFSET *pGoffset)
 
HRESULT WINAPI ScriptCacheGetHeight (HDC hdc, SCRIPT_CACHE *psc, LONG *height)
 
HRESULT WINAPI ScriptGetGlyphABCWidth (HDC hdc, SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
 
HRESULT WINAPI ScriptLayout (int runs, const BYTE *level, int *vistolog, int *logtovis)
 
HRESULT WINAPI ScriptStringGetLogicalWidths (SCRIPT_STRING_ANALYSIS ssa, int *piDx)
 
HRESULT WINAPI ScriptStringValidate (SCRIPT_STRING_ANALYSIS ssa)
 
const SIZE *WINAPI ScriptString_pSize (SCRIPT_STRING_ANALYSIS ssa)
 
const SCRIPT_LOGATTR *WINAPI ScriptString_pLogAttr (SCRIPT_STRING_ANALYSIS ssa)
 
const int *WINAPI ScriptString_pcOutChars (SCRIPT_STRING_ANALYSIS ssa)
 
HRESULT WINAPI ScriptStringGetOrder (SCRIPT_STRING_ANALYSIS ssa, UINT *order)
 
HRESULT WINAPI ScriptGetLogicalWidths (const SCRIPT_ANALYSIS *sa, int nbchars, int nbglyphs, const int *advances, const WORD *log_clust, const SCRIPT_VISATTR *sva, int *widths)
 
HRESULT WINAPI ScriptApplyLogicalWidth (const int *dx, int num_chars, int num_glyphs, const WORD *log_clust, const SCRIPT_VISATTR *sva, const int *advance, const SCRIPT_ANALYSIS *sa, ABC *abc, int *justify)
 
HRESULT WINAPI ScriptJustify (const SCRIPT_VISATTR *sva, const int *advance, int num_glyphs, int dx, int min_kashida, int *justify)
 
HRESULT WINAPI ScriptGetFontScriptTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags)
 
HRESULT WINAPI ScriptGetFontLanguageTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags)
 
HRESULT WINAPI ScriptGetFontFeatureTags (HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags)
 

Variables

static const struct usp10_script_range script_ranges []
 
const scriptData scriptInformation []
 
static const SCRIPT_PROPERTIESscript_props []
 
static CRITICAL_SECTION cs_script_cache = { &cs_script_cache_dbg, -1, 0, 0, 0, 0 }
 
static CRITICAL_SECTION_DEBUG cs_script_cache_dbg
 
static struct list script_cache_list = LIST_INIT(script_cache_list)
 

Macro Definition Documentation

◆ Numeric_space

#define Numeric_space   0x0020

◆ ZWJ

#define ZWJ   0x200D

◆ ZWNJ

#define ZWNJ   0x200C

◆ ZWSP

#define ZWSP   0x200B

Enumeration Type Documentation

◆ stringanalysis_flags

Enumerator
SCRIPT_STRING_ANALYSIS_FLAGS_SIZE 
SCRIPT_STRING_ANALYSIS_FLAGS_INVALID 

Definition at line 704 of file usp10.c.

Function Documentation

◆ _ItemizeInternal()

static HRESULT _ItemizeInternal ( const WCHAR pwcInChars,
int  cInChars,
int  cMaxItems,
const SCRIPT_CONTROL psControl,
const SCRIPT_STATE psState,
SCRIPT_ITEM pItems,
OPENTYPE_TAG pScriptTags,
int pcItems 
)
static

Definition at line 1344 of file usp10.c.

1348 {
1349 
1350 #define Numeric_space 0x0020
1351 #define ZWSP 0x200B
1352 #define ZWNJ 0x200C
1353 #define ZWJ 0x200D
1354 
1355  enum usp10_script last_indic = Script_Undefined;
1356  int cnt = 0, index = 0, str = 0;
1357  enum usp10_script New_Script = -1;
1358  int i;
1359  WORD *levels = NULL;
1360  WORD *layout_levels = NULL;
1361  WORD *overrides = NULL;
1362  WORD *strength = NULL;
1363  enum usp10_script *scripts;
1364  WORD baselevel = 0;
1365  WORD baselayout = 0;
1366  BOOL new_run;
1367  WORD layoutRTL = 0;
1368  BOOL forceLevels = FALSE;
1369  unsigned int consumed = 0;
1371 
1372  TRACE("%s,%d,%d,%p,%p,%p,%p\n", debugstr_wn(pwcInChars, cInChars), cInChars, cMaxItems,
1374 
1375  if (!pwcInChars || !cInChars || !pItems || cMaxItems < 2)
1376  return E_INVALIDARG;
1377 
1378  if (!(scripts = heap_calloc(cInChars, sizeof(*scripts))))
1379  return E_OUTOFMEMORY;
1380 
1381  for (i = 0; i < cInChars; i++)
1382  {
1383  if (!consumed)
1384  {
1385  scripts[i] = get_char_script(pwcInChars,i,cInChars,&consumed);
1386  consumed --;
1387  }
1388  else
1389  {
1390  scripts[i] = scripts[i-1];
1391  consumed --;
1392  }
1393  /* Devanagari danda (U+0964) and double danda (U+0965) are used for
1394  all Indic scripts */
1395  if ((pwcInChars[i] == 0x964 || pwcInChars[i] ==0x965) && last_indic != Script_Undefined)
1396  scripts[i] = last_indic;
1397  else if (is_indic(scripts[i]))
1398  last_indic = base_indic(scripts[i]);
1399 
1400  /* Some unicode points :
1401  (Zero Width Space U+200B - Right-to-Left Mark U+200F)
1402  (Left Right Embed U+202A - Left Right Override U+202D)
1403  (Left Right Isolate U+2066 - Pop Directional Isolate U+2069)
1404  will force us into bidi mode */
1405  if (!forceLevels && ((pwcInChars[i] >= 0x200B && pwcInChars[i] <= 0x200F) ||
1406  (pwcInChars[i] >= 0x202A && pwcInChars[i] <= 0x202E) ||
1407  (pwcInChars[i] >= 0x2066 && pwcInChars[i] <= 0x2069)))
1408 
1409  forceLevels = TRUE;
1410 
1411  /* Diacritical marks merge with other scripts */
1412  if (scripts[i] == Script_Diacritical)
1413  {
1414  if (i > 0)
1415  {
1416  if (pScriptTags)
1417  scripts[i] = scripts[i-1];
1418  else
1419  {
1420  int j;
1421  BOOL asian = FALSE;
1422  enum usp10_script first_script = scripts[i-1];
1423  for (j = i-1; j >= 0 && scripts[j] == first_script && pwcInChars[j] != Numeric_space; j--)
1424  {
1425  enum usp10_script original = scripts[j];
1426  if (original == Script_Ideograph || original == Script_Kana || original == Script_Yi || original == Script_CJK_Han || original == Script_Bopomofo)
1427  {
1428  asian = TRUE;
1429  break;
1430  }
1431  if (original != Script_MathAlpha && scriptInformation[scripts[j]].props.fComplex)
1432  break;
1433  scripts[j] = scripts[i];
1434  if (original == Script_Punctuation2)
1435  break;
1436  }
1437  if (j >= 0 && (scriptInformation[scripts[j]].props.fComplex || asian))
1438  scripts[i] = scripts[j];
1439  }
1440  }
1441  }
1442  }
1443 
1444  for (i = 0; i < cInChars; i++)
1445  {
1446  /* Joiners get merged preferencially right */
1447  if (i > 0 && (pwcInChars[i] == ZWJ || pwcInChars[i] == ZWNJ || pwcInChars[i] == ZWSP))
1448  {
1449  int j;
1450  if (i+1 == cInChars)
1451  scripts[i] = scripts[i-1];
1452  else
1453  {
1454  for (j = i+1; j < cInChars; j++)
1455  {
1456  if (pwcInChars[j] != ZWJ && pwcInChars[j] != ZWNJ
1457  && pwcInChars[j] != ZWSP && pwcInChars[j] != Numeric_space)
1458  {
1459  scripts[i] = scripts[j];
1460  break;
1461  }
1462  }
1463  }
1464  }
1465  }
1466 
1467  if (psState && psControl)
1468  {
1469  if (!(levels = heap_calloc(cInChars, sizeof(*levels))))
1470  goto nomemory;
1471 
1472  if (!(overrides = heap_calloc(cInChars, sizeof(*overrides))))
1473  goto nomemory;
1474 
1475  if (!(layout_levels = heap_calloc(cInChars, sizeof(*layout_levels))))
1476  goto nomemory;
1477 
1478  if (psState->fOverrideDirection)
1479  {
1480  if (!forceLevels)
1481  {
1482  SCRIPT_STATE s = *psState;
1483  s.fOverrideDirection = FALSE;
1484  BIDI_DetermineLevels(pwcInChars, cInChars, &s, psControl, layout_levels, overrides);
1485  if (odd(layout_levels[0]))
1486  forceLevels = TRUE;
1487  else for (i = 0; i < cInChars; i++)
1488  if (layout_levels[i]!=layout_levels[0])
1489  {
1490  forceLevels = TRUE;
1491  break;
1492  }
1493  }
1494 
1495  BIDI_DetermineLevels(pwcInChars, cInChars, psState, psControl, levels, overrides);
1496  }
1497  else
1498  {
1499  BIDI_DetermineLevels(pwcInChars, cInChars, psState, psControl, levels, overrides);
1500  memcpy(layout_levels, levels, cInChars * sizeof(WORD));
1501  }
1502  baselevel = levels[0];
1503  baselayout = layout_levels[0];
1504  for (i = 0; i < cInChars; i++)
1505  if (levels[i]!=levels[0])
1506  break;
1507  if (i >= cInChars && !odd(baselevel) && !odd(psState->uBidiLevel) && !forceLevels)
1508  {
1509  heap_free(levels);
1510  heap_free(overrides);
1511  heap_free(layout_levels);
1512  overrides = NULL;
1513  levels = NULL;
1514  layout_levels = NULL;
1515  }
1516  else
1517  {
1518  static const WCHAR math_punc[] = {'#','$','%','+',',','-','.','/',':',0x2212, 0x2044, 0x00a0,0};
1519  static const WCHAR repeatable_math_punc[] = {'#','$','%','+','-','/',0x2212, 0x2044,0};
1520 
1521  if (!(strength = heap_calloc(cInChars, sizeof(*strength))))
1522  goto nomemory;
1523  BIDI_GetStrengths(pwcInChars, cInChars, psControl, strength);
1524 
1525  /* We currently mis-level leading Diacriticals */
1526  if (scripts[0] == Script_Diacritical)
1527  for (i = 0; i < cInChars && scripts[0] == Script_Diacritical; i++)
1528  {
1529  levels[i] = odd(levels[i])?levels[i]+1:levels[i];
1530  strength[i] = BIDI_STRONG;
1531  }
1532 
1533  /* Math punctuation bordered on both sides by numbers can be
1534  merged into the number */
1535  for (i = 0; i < cInChars; i++)
1536  {
1537  if (i > 0 && i < cInChars-1 &&
1538  script_is_numeric(scripts[i-1]) &&
1539  wcschr(math_punc, pwcInChars[i]))
1540  {
1541  if (script_is_numeric(scripts[i+1]))
1542  {
1543  scripts[i] = scripts[i+1];
1544  levels[i] = levels[i-1];
1545  strength[i] = strength[i-1];
1546  i++;
1547  }
1548  else if (wcschr(repeatable_math_punc, pwcInChars[i]))
1549  {
1550  int j;
1551  for (j = i+1; j < cInChars; j++)
1552  {
1553  if (script_is_numeric(scripts[j]))
1554  {
1555  for(;i<j; i++)
1556  {
1557  scripts[i] = scripts[j];
1558  levels[i] = levels[i-1];
1559  strength[i] = strength[i-1];
1560  }
1561  }
1562  else if (pwcInChars[i] != pwcInChars[j]) break;
1563  }
1564  }
1565  }
1566  }
1567 
1568  for (i = 0; i < cInChars; i++)
1569  {
1570  /* Numerics at level 0 get bumped to level 2 */
1571  if (!overrides[i] && (levels[i] == 0 || (odd(psState->uBidiLevel)
1572  && levels[i] == psState->uBidiLevel + 1)) && script_is_numeric(scripts[i]))
1573  {
1574  levels[i] = 2;
1575  }
1576 
1577  /* Joiners get merged preferencially right */
1578  if (i > 0 && (pwcInChars[i] == ZWJ || pwcInChars[i] == ZWNJ || pwcInChars[i] == ZWSP))
1579  {
1580  int j;
1581  if (i+1 == cInChars && levels[i-1] == levels[i])
1582  strength[i] = strength[i-1];
1583  else
1584  for (j = i+1; j < cInChars && levels[i] == levels[j]; j++)
1585  if (pwcInChars[j] != ZWJ && pwcInChars[j] != ZWNJ
1586  && pwcInChars[j] != ZWSP && pwcInChars[j] != Numeric_space)
1587  {
1588  strength[i] = strength[j];
1589  break;
1590  }
1591  }
1592  }
1594  {
1595  /* Merge the neutrals */
1596  for (i = 0; i < cInChars; i++)
1597  {
1598  if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
1599  {
1600  int j;
1601  for (j = i; j > 0; j--)
1602  {
1603  if (levels[i] != levels[j])
1604  break;
1605  if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
1606  {
1607  scripts[i] = scripts[j];
1608  strength[i] = strength[j];
1609  break;
1610  }
1611  }
1612  }
1613  /* Try going the other way */
1614  if (strength[i] == BIDI_NEUTRAL || strength[i] == BIDI_WEAK)
1615  {
1616  int j;
1617  for (j = i; j < cInChars; j++)
1618  {
1619  if (levels[i] != levels[j])
1620  break;
1621  if ((strength[j] == BIDI_STRONG) || (strength[i] == BIDI_NEUTRAL && strength[j] == BIDI_WEAK))
1622  {
1623  scripts[i] = scripts[j];
1624  strength[i] = strength[j];
1625  break;
1626  }
1627  }
1628  }
1629  }
1630  }
1631  }
1632  }
1633 
1634  while ((!levels || (levels && cnt+1 < cInChars && levels[cnt+1] == levels[0]))
1635  && (cnt < cInChars && pwcInChars[cnt] == Numeric_space))
1636  cnt++;
1637 
1638  if (cnt == cInChars) /* All Spaces */
1639  {
1640  cnt = 0;
1641  New_Script = scripts[cnt];
1642  }
1643 
1644  pItems[index].iCharPos = 0;
1645  pItems[index].a = scriptInformation[scripts[cnt]].a;
1646  if (pScriptTags)
1647  pScriptTags[index] = scriptInformation[scripts[cnt]].scriptTag;
1648 
1649  if (strength && strength[cnt] == BIDI_STRONG)
1650  str = strength[cnt];
1651  else if (strength)
1652  str = strength[0];
1653 
1654  cnt = 0;
1655 
1656  if (levels)
1657  {
1658  if (strength[cnt] == BIDI_STRONG)
1659  layoutRTL = odd(layout_levels[cnt]);
1660  else
1661  layoutRTL = (psState->uBidiLevel || odd(layout_levels[cnt]));
1662  if (overrides)
1663  pItems[index].a.s.fOverrideDirection = (overrides[cnt] != 0);
1664  pItems[index].a.fRTL = odd(levels[cnt]);
1665  if (script_is_numeric(pItems[index].a.eScript))
1666  pItems[index].a.fLayoutRTL = layoutRTL;
1667  else
1668  pItems[index].a.fLayoutRTL = pItems[index].a.fRTL;
1669  pItems[index].a.s.uBidiLevel = levels[cnt];
1670  }
1671  else if (!pItems[index].a.s.uBidiLevel || (overrides && overrides[cnt]))
1672  {
1673  if (pItems[index].a.s.uBidiLevel != baselevel)
1674  pItems[index].a.s.fOverrideDirection = TRUE;
1675  layoutRTL = odd(baselayout);
1676  pItems[index].a.s.uBidiLevel = baselevel;
1677  pItems[index].a.fRTL = odd(baselevel);
1678  if (script_is_numeric(pItems[index].a.eScript))
1679  pItems[index].a.fLayoutRTL = odd(baselayout);
1680  else
1681  pItems[index].a.fLayoutRTL = pItems[index].a.fRTL;
1682  }
1683 
1684  TRACE("New_Level=%i New_Strength=%i New_Script=%d, eScript=%d index=%d cnt=%d iCharPos=%d\n",
1685  levels?levels[cnt]:-1, str, New_Script, pItems[index].a.eScript, index, cnt,
1686  pItems[index].iCharPos);
1687 
1688  for (cnt=1; cnt < cInChars; cnt++)
1689  {
1690  if(pwcInChars[cnt] != Numeric_space)
1691  New_Script = scripts[cnt];
1692  else if (levels)
1693  {
1694  int j = 1;
1695  while (cnt + j < cInChars - 1 && pwcInChars[cnt+j] == Numeric_space && levels[cnt] == levels[cnt+j])
1696  j++;
1697  if (cnt + j < cInChars && levels[cnt] == levels[cnt+j])
1698  New_Script = scripts[cnt+j];
1699  else
1700  New_Script = scripts[cnt];
1701  }
1702 
1703  new_run = FALSE;
1704  /* merge space strengths*/
1705  if (strength && strength[cnt] == BIDI_STRONG && str != BIDI_STRONG && New_Script == pItems[index].a.eScript)
1706  str = BIDI_STRONG;
1707 
1708  if (strength && strength[cnt] == BIDI_NEUTRAL && str == BIDI_STRONG && pwcInChars[cnt] != Numeric_space && New_Script == pItems[index].a.eScript)
1709  str = BIDI_NEUTRAL;
1710 
1711  /* changes in level */
1712  if (levels && (levels[cnt] != pItems[index].a.s.uBidiLevel))
1713  {
1714  TRACE("Level break(%i/%i)\n",pItems[index].a.s.uBidiLevel,levels[cnt]);
1715  new_run = TRUE;
1716  }
1717  /* changes in strength */
1718  else if (strength && pwcInChars[cnt] != Numeric_space && str != strength[cnt])
1719  {
1720  TRACE("Strength break (%i/%i)\n",str,strength[cnt]);
1721  new_run = TRUE;
1722  }
1723  /* changes in script */
1724  else if (((pwcInChars[cnt] != Numeric_space) && (New_Script != -1) && (New_Script != pItems[index].a.eScript)) || (New_Script == Script_Control))
1725  {
1726  TRACE("Script break(%i/%i)\n",pItems[index].a.eScript,New_Script);
1727  new_run = TRUE;
1728  }
1729 
1730  if (!new_run && strength && str == BIDI_STRONG)
1731  {
1732  layoutRTL = odd(layout_levels[cnt]);
1733  if (script_is_numeric(pItems[index].a.eScript))
1734  pItems[index].a.fLayoutRTL = layoutRTL;
1735  }
1736 
1737  if (new_run)
1738  {
1739  TRACE("New_Level = %i, New_Strength = %i, New_Script=%d, eScript=%d\n", levels?levels[cnt]:-1, strength?strength[cnt]:str, New_Script, pItems[index].a.eScript);
1740 
1741  index++;
1742  if (index+1 > cMaxItems)
1743  goto nomemory;
1744 
1745  if (strength)
1746  str = strength[cnt];
1747 
1748  pItems[index].iCharPos = cnt;
1749  memset(&pItems[index].a, 0, sizeof(SCRIPT_ANALYSIS));
1750 
1751  pItems[index].a = scriptInformation[New_Script].a;
1752  if (pScriptTags)
1754  if (levels)
1755  {
1756  if (overrides)
1757  pItems[index].a.s.fOverrideDirection = (overrides[cnt] != 0);
1758  if (layout_levels[cnt] == 0)
1759  layoutRTL = 0;
1760  else
1761  layoutRTL = (layoutRTL || odd(layout_levels[cnt]));
1762  pItems[index].a.fRTL = odd(levels[cnt]);
1763  if (script_is_numeric(pItems[index].a.eScript))
1764  pItems[index].a.fLayoutRTL = layoutRTL;
1765  else
1766  pItems[index].a.fLayoutRTL = pItems[index].a.fRTL;
1767  pItems[index].a.s.uBidiLevel = levels[cnt];
1768  }
1769  else if (!pItems[index].a.s.uBidiLevel || (overrides && overrides[cnt]))
1770  {
1771  if (pItems[index].a.s.uBidiLevel != baselevel)
1772  pItems[index].a.s.fOverrideDirection = TRUE;
1773  pItems[index].a.s.uBidiLevel = baselevel;
1774  pItems[index].a.fRTL = odd(baselevel);
1775  if (script_is_numeric(pItems[index].a.eScript))
1776  pItems[index].a.fLayoutRTL = layoutRTL;
1777  else
1778  pItems[index].a.fLayoutRTL = pItems[index].a.fRTL;
1779  }
1780 
1781  TRACE("index=%d cnt=%d iCharPos=%d\n", index, cnt, pItems[index].iCharPos);
1782  }
1783  }
1784 
1785  /* While not strictly necessary according to the spec, make sure the n+1
1786  * item is set up to prevent random behaviour if the caller erroneously
1787  * checks the n+1 structure */
1788  index++;
1789  if (index + 1 > cMaxItems) goto nomemory;
1790  memset(&pItems[index].a, 0, sizeof(SCRIPT_ANALYSIS));
1791 
1792  TRACE("index=%d cnt=%d iCharPos=%d\n", index, cnt, pItems[index].iCharPos);
1793 
1794  /* Set one SCRIPT_STATE item being returned */
1795  if (pcItems) *pcItems = index;
1796 
1797  /* Set SCRIPT_ITEM */
1798  pItems[index].iCharPos = cnt; /* the last item contains the ptr to the lastchar */
1799  res = S_OK;
1800 nomemory:
1801  heap_free(levels);
1802  heap_free(overrides);
1803  heap_free(layout_levels);
1804  heap_free(strength);
1805  heap_free(scripts);
1806  return res;
1807 }
BOOL BIDI_DetermineLevels(const WCHAR *lpString, unsigned int uCount, const SCRIPT_STATE *s, const SCRIPT_CONTROL *c, WORD *lpOutLevels, WORD *lpOutOverrides)
Definition: bidi.c:1088
static int cInChars
Definition: usp10.c:62
GLsizei levels
Definition: glext.h:7884
#define TRUE
Definition: types.h:120
#define BIDI_NEUTRAL
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG * pScriptTags
Definition: usp10.c:62
DWORD fMergeNeutralItems
Definition: usp10.h:102
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
#define BIDI_WEAK
#define Numeric_space
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
OPENTYPE_TAG scriptTag
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ZWSP
#define E_INVALIDARG
Definition: ddrawi.h:101
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
SCRIPT_ANALYSIS a
GLuint index
Definition: glext.h:6031
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM * pItems
Definition: usp10.c:62
#define TRACE(s)
Definition: solgame.cpp:4
const scriptData scriptInformation[]
Definition: usp10.c:305
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
static int int const SCRIPT_CONTROL * psControl
Definition: usp10.c:62
BOOL BIDI_GetStrengths(const WCHAR *string, unsigned int count, const SCRIPT_CONTROL *c, WORD *strength)
Definition: bidi.c:1249
static int int cMaxItems
Definition: usp10.c:62
static enum usp10_script get_char_script(const WCHAR *str, unsigned int index, unsigned int end, unsigned int *consumed)
Definition: usp10.c:969
static BOOL script_is_numeric(enum usp10_script script)
Definition: usp10.c:1339
#define index(s, c)
Definition: various.h:29
#define BIDI_STRONG
#define ZWNJ
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLdouble s
Definition: gl.h:2039
#define debugstr_wn
Definition: kernel32.h:33
#define S_OK
Definition: intsafe.h:51
static int int const SCRIPT_CONTROL const SCRIPT_STATE * psState
Definition: usp10.c:62
int consumed
Definition: scanf.h:134
static BOOL is_indic(enum usp10_script script)
Definition: usp10.c:1305
static const WCHAR props[]
Definition: wbemdisp.c:288
GLuint res
Definition: glext.h:9613
static enum usp10_script base_indic(enum usp10_script script)
Definition: usp10.c:1310
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define memset(x, y, z)
Definition: compat.h:39
#define odd(x)
Definition: bidi.c:51
#define ZWJ
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
usp10_script

Referenced by ScriptItemize(), and ScriptItemizeOpenType().

◆ base_indic()

static enum usp10_script base_indic ( enum usp10_script  script)
inlinestatic

Definition at line 1310 of file usp10.c.

1311 {
1312  switch (script)
1313  {
1314  case Script_Devanagari:
1316  case Script_Bengali:
1319  case Script_Gurmukhi:
1321  case Script_Gujarati:
1324  case Script_Oriya:
1325  case Script_Oriya_Numeric: return Script_Oriya;
1326  case Script_Tamil:
1327  case Script_Tamil_Numeric: return Script_Tamil;
1328  case Script_Telugu:
1329  case Script_Telugu_Numeric: return Script_Telugu;
1330  case Script_Kannada:
1332  case Script_Malayalam:
1334  default:
1335  return Script_Undefined;
1336  };
1337 }
script
Definition: msipriv.h:374

Referenced by _ItemizeInternal().

◆ compare_FindGlyph()

static int __cdecl compare_FindGlyph ( const void a,
const void b 
)
static

Definition at line 1028 of file usp10.c.

1029 {
1031  const WORD *idx= (WORD*)b;
1032  int rc = 0;
1033 
1034  if ( find->target > *idx)
1035  rc = 1;
1036  else if (find->target < *idx)
1037  rc = -1;
1038 
1039  if (!find->ascending)
1040  rc *= -1;
1041  return rc;
1042 }
unsigned int idx
Definition: utils.c:41
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
unsigned short WORD
Definition: ntddk_ex.h:93
static TAGID TAGID find
Definition: db.cpp:153
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204

Referenced by USP10_FindGlyphInLogClust().

◆ decode_surrogate_pair()

static DWORD decode_surrogate_pair ( const WCHAR str,
unsigned int  index,
unsigned int  end 
)
static

Definition at line 946 of file usp10.c.

947 {
948  if (index < end-1 && IS_SURROGATE_PAIR(str[index],str[index+1]))
949  {
950  DWORD ch = 0x10000 + ((str[index] - 0xd800) << 10) + (str[index+1] - 0xdc00);
951  TRACE("Surrogate Pair %x %x => %x\n",str[index], str[index+1], ch);
952  return ch;
953  }
954  return 0;
955 }
GLuint GLuint end
Definition: gl.h:1545
const WCHAR * str
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define index(s, c)
Definition: various.h:29
#define IS_SURROGATE_PAIR(high, low)
Definition: winnls.h:678

Referenced by get_char_script(), and ScriptShapeOpenType().

◆ does_glyph_start_cluster()

static BOOL does_glyph_start_cluster ( const SCRIPT_VISATTR pva,
const WORD pwLogClust,
int  cChars,
int  glyph,
int  direction 
)
inlinestatic

Definition at line 2189 of file usp10.c.

2190 {
2191  if (pva[glyph].fClusterStart)
2192  return TRUE;
2193  if (USP10_FindGlyphInLogClust(pwLogClust, cChars, glyph) >= 0)
2194  return TRUE;
2195 
2196  return FALSE;
2197 }
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
#define TRUE
Definition: types.h:120
int USP10_FindGlyphInLogClust(const WORD *pwLogClust, int cChars, WORD target)
Definition: usp10.c:1044
#define FALSE
Definition: types.h:117
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64

Referenced by get_glyph_cluster_advance(), and SS_ItemOut().

◆ find_fallback_font()

static void find_fallback_font ( enum usp10_script  scriptid,
WCHAR FaceName 
)
static

Definition at line 1961 of file usp10.c.

1962 {
1963  HKEY hkey;
1964 
1965  if (!RegOpenKeyA(HKEY_CURRENT_USER, "Software\\Wine\\Uniscribe\\Fallback", &hkey))
1966  {
1967  static const WCHAR szFmt[] = {'%','x',0};
1968  WCHAR value[10];
1969  DWORD count = LF_FACESIZE * sizeof(WCHAR);
1970  DWORD type;
1971 
1972  swprintf(value, szFmt, scriptInformation[scriptid].scriptTag);
1973  if (RegQueryValueExW(hkey, value, 0, &type, (BYTE *)FaceName, &count))
1974  lstrcpyW(FaceName,scriptInformation[scriptid].fallbackFont);
1975  RegCloseKey(hkey);
1976  }
1977  else
1978  lstrcpyW(FaceName,scriptInformation[scriptid].fallbackFont);
1979 }
LONG WINAPI RegOpenKeyA(HKEY hKey, LPCSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3257
#define LF_FACESIZE
Definition: dimm.idl:39
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define HKEY_CURRENT_USER
Definition: winreg.h:11
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
const scriptData scriptInformation[]
Definition: usp10.c:305
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: xxhash.c:193
#define lstrcpyW
Definition: compat.h:497

Referenced by ScriptStringAnalyse().

◆ get_cache_font_properties()

static void get_cache_font_properties ( SCRIPT_FONTPROPERTIES sfp,
ScriptCache sc 
)
inlinestatic

Definition at line 810 of file usp10.c.

811 {
812  *sfp = sc->sfp;
813 }
SCRIPT_FONTPROPERTIES sfp

Referenced by ScriptGetFontProperties().

◆ get_cache_glyph()

static WORD get_cache_glyph ( SCRIPT_CACHE psc,
DWORD  c 
)
inlinestatic

Definition at line 825 of file usp10.c.

826 {
827  CacheGlyphPage *page = ((ScriptCache *)*psc)->page[c / 0x10000];
828  WORD *block;
829 
830  if (!page) return 0;
831  block = page->glyphs[(c % 0x10000) >> GLYPH_BLOCK_SHIFT];
832  if (!block) return 0;
833  return block[(c % 0x10000) & GLYPH_BLOCK_MASK];
834 }
static unsigned int block
Definition: xmlmemory.c:118
Definition: module.h:566
#define GLYPH_BLOCK_MASK
const GLubyte * c
Definition: glext.h:8905
unsigned short WORD
Definition: ntddk_ex.h:93
static SCRIPT_CACHE * psc
Definition: usp10.c:64
#define GLYPH_BLOCK_SHIFT

Referenced by ScriptGetCMap(), and ScriptShapeOpenType().

◆ get_cache_glyph_widths()

static BOOL get_cache_glyph_widths ( SCRIPT_CACHE psc,
WORD  glyph,
ABC abc 
)
inlinestatic

Definition at line 847 of file usp10.c.

848 {
849  static const ABC nil;
850  ABC *block = ((ScriptCache *)*psc)->widths[glyph >> GLYPH_BLOCK_SHIFT];
851 
852  if (!block || !memcmp(&block[glyph & GLYPH_BLOCK_MASK], &nil, sizeof(ABC))) return FALSE;
853  memcpy(abc, &block[glyph & GLYPH_BLOCK_MASK], sizeof(ABC));
854  return TRUE;
855 }
static unsigned int block
Definition: xmlmemory.c:118
Definition: wingdi.h:1409
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define GLYPH_BLOCK_MASK
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static SCRIPT_CACHE * psc
Definition: usp10.c:64
#define GLYPH_BLOCK_SHIFT
#define nil
Definition: compat.h:23
static UINT UINT LPWORD LPABC abc
Definition: font.c:44

Referenced by ScriptGetGlyphABCWidth(), and ScriptPlaceOpenType().

◆ get_cache_height()

static LONG get_cache_height ( SCRIPT_CACHE psc)
inlinestatic

Definition at line 815 of file usp10.c.

816 {
817  return ((ScriptCache *)*psc)->tm.tmHeight;
818 }
static SCRIPT_CACHE * psc
Definition: usp10.c:64

Referenced by ScriptCacheGetHeight().

◆ get_cache_pitch_family()

static BYTE get_cache_pitch_family ( SCRIPT_CACHE psc)
inlinestatic

Definition at line 820 of file usp10.c.

821 {
822  return ((ScriptCache *)*psc)->tm.tmPitchAndFamily;
823 }
static SCRIPT_CACHE * psc
Definition: usp10.c:64

Referenced by ScriptGetGlyphABCWidth(), and ScriptPlaceOpenType().

◆ get_char_script()

static enum usp10_script get_char_script ( const WCHAR str,
unsigned int  index,
unsigned int  end,
unsigned int consumed 
)
static

Definition at line 969 of file usp10.c.

971 {
972  static const WCHAR latin_punc[] = {'#','$','&','\'',',',';','<','>','?','@','\\','^','_','`','{','|','}','~', 0x00a0, 0};
973  struct usp10_script_range *range;
974  WORD type = 0, type2 = 0;
975  DWORD ch;
976 
977  *consumed = 1;
978 
979  if (str[index] == 0xc || str[index] == 0x20 || str[index] == 0x202f)
980  return Script_CR;
981 
982  /* These punctuation characters are separated out as Latin punctuation */
983  if (wcschr(latin_punc,str[index]))
984  return Script_Punctuation2;
985 
986  /* These chars are itemized as Punctuation by Windows */
987  if (str[index] == 0x2212 || str[index] == 0x2044)
988  return Script_Punctuation;
989 
990  /* Currency Symbols by Unicode point */
991  switch (str[index])
992  {
993  case 0x09f2:
994  case 0x09f3: return Script_Bengali_Currency;
995  case 0x0af1: return Script_Gujarati_Currency;
996  case 0x0e3f: return Script_Thai_Currency;
997  case 0x20aa: return Script_Hebrew_Currency;
998  case 0x20ab: return Script_Vietnamese_Currency;
999  case 0xfb29: return Script_Hebrew_Currency;
1000  }
1001 
1003  GetStringTypeW(CT_CTYPE2, &str[index], 1, &type2);
1004 
1005  if (type == 0)
1006  return SCRIPT_UNDEFINED;
1007 
1008  if (type & C1_CNTRL)
1009  return Script_Control;
1010 
1012  if (ch)
1013  *consumed = 2;
1014  else
1015  ch = str[index];
1016 
1019  return (*consumed == 2) ? Script_Surrogates : Script_Undefined;
1020 
1021  if (range->numericScript && (type & C1_DIGIT || type2 == C2_ARABICNUMBER))
1022  return range->numericScript;
1023  if (range->punctScript && type & C1_PUNCT)
1024  return range->punctScript;
1025  return range->script;
1026 }
#define CT_CTYPE2
Definition: winnls.h:235
#define C1_CNTRL
Definition: unicode.h:36
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
const WCHAR * str
GLuint index
Definition: glext.h:6031
static DWORD decode_surrogate_pair(const WCHAR *str, unsigned int index, unsigned int end)
Definition: usp10.c:946
_CONST_RETURN wchar_t *__cdecl wcschr(_In_z_ const wchar_t *_Str, wchar_t _Ch)
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: lang.c:1699
#define C1_DIGIT
Definition: unicode.h:33
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CT_CTYPE1
Definition: winnls.h:234
#define C1_PUNCT
Definition: unicode.h:35
#define index(s, c)
Definition: various.h:29
GLenum GLint * range
Definition: glext.h:7539
int consumed
Definition: scanf.h:134
#define ARRAY_SIZE(a)
Definition: main.h:24
#define C2_ARABICNUMBER
Definition: winnls.h:252
static int __cdecl usp10_compare_script_range(const void *key, const void *value)
Definition: usp10.c:957
static const struct usp10_script_range script_ranges[]
#define SCRIPT_UNDEFINED
Definition: usp10.h:69
#define bsearch

Referenced by _ItemizeInternal(), and ScriptIsComplex().

◆ get_cluster_advance()

static int get_cluster_advance ( const int piAdvance,
const SCRIPT_VISATTR psva,
const WORD pwLogClust,
int  cGlyphs,
int  cChars,
int  cluster,
int  direction 
)
inlinestatic

Definition at line 2793 of file usp10.c.

2797 {
2798  int glyph_start;
2799  int glyph_end;
2800  int i, advance;
2801 
2802  if (direction > 0)
2803  i = 0;
2804  else
2805  i = (cChars - 1);
2806 
2807  for (glyph_start = -1, glyph_end = -1; i < cChars && i >= 0 && (glyph_start < 0 || glyph_end < 0); i+=direction)
2808  {
2809  if (glyph_start < 0 && pwLogClust[i] != cluster) continue;
2810  if (pwLogClust[i] == cluster && glyph_start < 0) glyph_start = pwLogClust[i];
2811  if (glyph_start >= 0 && glyph_end < 0 && pwLogClust[i] != cluster) glyph_end = pwLogClust[i];
2812  }
2813  if (glyph_end < 0)
2814  {
2815  if (direction > 0)
2816  glyph_end = cGlyphs;
2817  else
2818  {
2819  /* Don't fully understand multi-glyph reversed clusters yet,
2820  * do they occur for real or just in our test? */
2821  FIXME("multi-glyph reversed clusters found\n");
2822  glyph_end = glyph_start + 1;
2823  }
2824  }
2825 
2826  /* Check for fClusterStart, finding this generally would mean a malformed set of data */
2827  for (i = glyph_start+1; i< glyph_end; i++)
2828  {
2829  if (psva[i].fClusterStart)
2830  {
2831  glyph_end = i;
2832  break;
2833  }
2834  }
2835 
2836  for (advance = 0, i = glyph_start; i < glyph_end; i++)
2837  advance += piAdvance[i];
2838 
2839  return advance;
2840 }
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:111
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)

Referenced by ScriptXtoCP().

◆ get_cluster_data()

static BOOL get_cluster_data ( const WORD pwLogClust,
int  cChars,
int  cluster_index,
int cluster_size,
int start_index 
)
inlinestatic

Definition at line 2760 of file usp10.c.

2761 {
2762  int size = 0;
2763  int i;
2764 
2765  for (i = 0; i < cChars; i++)
2766  {
2767  if (pwLogClust[i] == cluster_index)
2768  {
2769  if (!size && start_index)
2770  {
2771  *start_index = i;
2772  if (!cluster_size)
2773  return TRUE;
2774  }
2775  size++;
2776  }
2777  else if (size) break;
2778  }
2779  if (cluster_size)
2780  *cluster_size = size;
2781 
2782  return (size > 0);
2783 }
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__u8 cluster_size
Definition: mkdosfs.c:362
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
GLsizeiptr size
Definition: glext.h:5919

Referenced by ScriptXtoCP().

◆ get_cluster_size()

static int get_cluster_size ( const WORD pwLogClust,
int  cChars,
int  item,
int  direction,
int iCluster,
int check_out 
)
inlinestatic

Definition at line 2594 of file usp10.c.

2596 {
2597  int clust_size = 1;
2598  int check;
2599  WORD clust = pwLogClust[item];
2600 
2601  for (check = item+direction; check < cChars && check >= 0; check+=direction)
2602  {
2603  if (pwLogClust[check] == clust)
2604  {
2605  clust_size ++;
2606  if (iCluster && *iCluster == -1)
2607  *iCluster = item;
2608  }
2609  else break;
2610  }
2611 
2612  if (check_out)
2613  *check_out = check;
2614 
2615  return clust_size;
2616 }
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
unsigned short WORD
Definition: ntddk_ex.h:93
void check(CONTEXT *pContext)
Definition: NtContinue.c:68
static ATOM item
Definition: dde.c:856

Referenced by ScriptCPtoX(), ScriptGetLogicalWidths(), and ScriptStringGetLogicalWidths().

◆ get_glyph_cluster_advance()

static int get_glyph_cluster_advance ( const int piAdvance,
const SCRIPT_VISATTR pva,
const WORD pwLogClust,
int  cGlyphs,
int  cChars,
int  glyph,
int  direction 
)
inlinestatic

Definition at line 2618 of file usp10.c.

2619 {
2620  int advance;
2621  int log_clust_max;
2622 
2623  advance = piAdvance[glyph];
2624 
2625  if (pwLogClust[0] > pwLogClust[cChars-1])
2626  log_clust_max = pwLogClust[0];
2627  else
2628  log_clust_max = pwLogClust[cChars-1];
2629 
2630  if (glyph > log_clust_max)
2631  return advance;
2632 
2633  for (glyph+=direction; glyph < cGlyphs && glyph >= 0; glyph +=direction)
2634  {
2635 
2636  if (does_glyph_start_cluster(pva, pwLogClust, cChars, glyph, direction))
2637  break;
2638  if (glyph > log_clust_max)
2639  break;
2640  advance += piAdvance[glyph];
2641  }
2642 
2643  return advance;
2644 }
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
static BOOL does_glyph_start_cluster(const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cChars, int glyph, int direction)
Definition: usp10.c:2189
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)

Referenced by ScriptCPtoX(), ScriptGetLogicalWidths(), and ScriptStringGetLogicalWidths().

◆ getGivenTabWidth()

static int getGivenTabWidth ( ScriptCache psc,
SCRIPT_TABDEF pTabdef,
int  charPos,
int  current_x 
)
inlinestatic

Definition at line 1860 of file usp10.c.

1861 {
1862  int defWidth;
1863  int cTabStops=0;
1864  INT *lpTabPos = NULL;
1865  INT nTabOrg = 0;
1866  INT x = 0;
1867 
1868  if (pTabdef)
1869  lpTabPos = pTabdef->pTabStops;
1870 
1871  if (pTabdef && pTabdef->iTabOrigin)
1872  {
1873  if (pTabdef->iScale)
1874  nTabOrg = (pTabdef->iTabOrigin * pTabdef->iScale)/4;
1875  else
1876  nTabOrg = pTabdef->iTabOrigin * psc->tm.tmAveCharWidth;
1877  }
1878 
1879  if (pTabdef)
1880  cTabStops = pTabdef->cTabStops;
1881 
1882  if (cTabStops == 1)
1883  {
1884  if (pTabdef->iScale)
1885  defWidth = ((pTabdef->pTabStops[0])*pTabdef->iScale) / 4;
1886  else
1887  defWidth = (pTabdef->pTabStops[0])*psc->tm.tmAveCharWidth;
1888  cTabStops = 0;
1889  }
1890  else
1891  {
1892  if (pTabdef->iScale)
1893  defWidth = (32 * pTabdef->iScale) / 4;
1894  else
1895  defWidth = 8 * psc->tm.tmAveCharWidth;
1896  }
1897 
1898  for (; cTabStops>0 ; lpTabPos++, cTabStops--)
1899  {
1900  int position = *lpTabPos;
1901  if (position < 0)
1902  position = -1 * position;
1903  if (pTabdef->iScale)
1904  position = (position * pTabdef->iScale) / 4;
1905  else
1906  position = position * psc->tm.tmAveCharWidth;
1907 
1908  if( nTabOrg + position > current_x)
1909  {
1910  if( position >= 0)
1911  {
1912  /* a left aligned tab */
1913  x = (nTabOrg + position) - current_x;
1914  break;
1915  }
1916  else
1917  {
1918  FIXME("Negative tabstop\n");
1919  break;
1920  }
1921  }
1922  }
1923  if ((!cTabStops) && (defWidth > 0))
1924  x =((((current_x - nTabOrg) / defWidth)+1) * defWidth) - current_x;
1925  else if ((!cTabStops) && (defWidth < 0))
1926  FIXME("TODO: Negative defWidth\n");
1927 
1928  return x;
1929 }
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int32_t INT
Definition: typedefs.h:58
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
static SCRIPT_CACHE * psc
Definition: usp10.c:64
int * pTabStops
Definition: usp10.h:173

Referenced by ScriptStringAnalyse().

◆ init_script_cache()

static HRESULT init_script_cache ( const HDC  hdc,
SCRIPT_CACHE psc 
)
static

Definition at line 866 of file usp10.c.

867 {
868  ScriptCache *sc;
869  unsigned size;
870  LOGFONTW lf;
871 
872  if (!psc) return E_INVALIDARG;
873  if (*psc) return S_OK;
874  if (!hdc) return E_PENDING;
875 
876  if (!GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf))
877  {
878  return E_INVALIDARG;
879  }
880  /* Ensure canonical result by zeroing extra space in lfFaceName */
881  size = lstrlenW(lf.lfFaceName);
882  memset(lf.lfFaceName + size, 0, sizeof(lf.lfFaceName) - size * sizeof(WCHAR));
883 
886  {
887  if (!memcmp(&sc->lf, &lf, sizeof(lf)))
888  {
889  sc->refcount++;
891  *psc = sc;
892  return S_OK;
893  }
894  }
896 
897  if (!(sc = heap_alloc_zero(sizeof(ScriptCache)))) return E_OUTOFMEMORY;
898  if (!GetTextMetricsW(hdc, &sc->tm))
899  {
900  heap_free(sc);
901  return E_INVALIDARG;
902  }
904  if (size)
905  {
906  sc->otm = heap_alloc(size);
907  sc->otm->otmSize = size;
909  }
910  sc->sfnt = (GetFontData(hdc, MS_MAKE_TAG('h','e','a','d'), 0, NULL, 0)!=GDI_ERROR);
911  if (!set_cache_font_properties(hdc, sc))
912  {
913  heap_free(sc);
914  return E_INVALIDARG;
915  }
916  sc->lf = lf;
917  sc->refcount = 1;
918  *psc = sc;
919 
923  {
924  if (sc != *psc && !memcmp(&sc->lf, &lf, sizeof(lf)))
925  {
926  /* Another thread won the race. Use their cache instead of ours */
927  list_remove(&sc->entry);
928  sc->refcount++;
930  heap_free(*psc);
931  *psc = sc;
932  return S_OK;
933  }
934  }
936  TRACE("<- %p\n", sc);
937  return S_OK;
938 }
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
struct list entry
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static CRITICAL_SECTION cs_script_cache
Definition: usp10.c:681
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
#define lstrlenW
Definition: compat.h:498
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
DWORD WINAPI GetFontData(HDC hdc, DWORD dwTable, DWORD dwOffset, LPVOID lpvBuffer, DWORD cbData)
Definition: font.c:2654
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MS_MAKE_TAG(_x1, _x2, _x3, _x4)
Definition: usp10.c:136
#define OBJ_FONT
Definition: objidl.idl:1414
OUTLINETEXTMETRICW * otm
HDC hdc
Definition: main.c:9
uint32_t entry
Definition: isohybrid.c:63
TEXTMETRICW tm
static BOOL set_cache_font_properties(const HDC hdc, ScriptCache *sc)
Definition: usp10.c:761
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
WCHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:72
UINT WINAPI GetOutlineTextMetricsW(_In_ HDC hdc, _In_ UINT cjCopy, _Out_writes_bytes_opt_(cjCopy) LPOUTLINETEXTMETRICW potm)
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
static struct list script_cache_list
Definition: usp10.c:689
#define E_PENDING
Definition: dinput.h:172
#define GDI_ERROR
Definition: wingdi.h:1308
#define memset(x, y, z)
Definition: compat.h:39
HGDIOBJ WINAPI GetCurrentObject(_In_ HDC, _In_ UINT)
Definition: dc.c:441
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by requires_fallback(), ScriptCacheGetHeight(), ScriptGetCMap(), ScriptGetFontFeatureTags(), ScriptGetFontLanguageTags(), ScriptGetFontProperties(), ScriptGetFontScriptTags(), ScriptGetGlyphABCWidth(), ScriptPlaceOpenType(), and ScriptShapeOpenType().

◆ is_indic()

static BOOL is_indic ( enum usp10_script  script)
inlinestatic

Definition at line 1305 of file usp10.c.

Referenced by _ItemizeInternal().

◆ mirror_char()

static WCHAR mirror_char ( WCHAR  ch)
static

Definition at line 940 of file usp10.c.

941 {
942  extern const WCHAR wine_mirror_map[] DECLSPEC_HIDDEN;
943  return ch + wine_mirror_map[wine_mirror_map[ch >> 8] + (ch & 0xff)];
944 }
const WCHAR DECLSPEC_HIDDEN wine_mirror_map[3544]
Definition: mirror.c:7
#define DECLSPEC_HIDDEN
Definition: precomp.h:8
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ScriptGetCMap(), and ScriptShapeOpenType().

◆ requires_fallback()

static BOOL requires_fallback ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
const WCHAR pwcInChars,
int  cChars 
)
static

Definition at line 1934 of file usp10.c.

1936 {
1937  /* FIXME: When to properly fallback is still a bit of a mystery */
1938  WORD *glyphs;
1939 
1940  if (psa->fNoGlyphIndex)
1941  return FALSE;
1942 
1943  if (init_script_cache(hdc, psc) != S_OK)
1944  return FALSE;
1945 
1947  return TRUE;
1948 
1949  if (!(glyphs = heap_calloc(cChars, sizeof(*glyphs))))
1950  return FALSE;
1951  if (ScriptGetCMap(hdc, psc, pwcInChars, cChars, 0, glyphs) != S_OK)
1952  {
1953  heap_free(glyphs);
1954  return TRUE;
1955  }
1956  heap_free(glyphs);
1957 
1958  return FALSE;
1959 }
#define TRUE
Definition: types.h:120
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
static UINT UINT LPWORD glyphs
Definition: font.c:44
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa)
Definition: shape.c:3454
#define FALSE
Definition: types.h:117
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
unsigned short WORD
Definition: ntddk_ex.h:93
HDC hdc
Definition: main.c:9
HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs)
Definition: usp10.c:3554
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ScriptStringAnalyse().

◆ script_is_numeric()

static BOOL script_is_numeric ( enum usp10_script  script)
static

Definition at line 1339 of file usp10.c.

1340 {
1342 }
SCRIPT_PROPERTIES props
script
Definition: msipriv.h:374
const scriptData scriptInformation[]
Definition: usp10.c:305
DWORD fNumeric
Definition: usp10.h:108

Referenced by _ItemizeInternal().

◆ ScriptApplyDigitSubstitution()

HRESULT WINAPI ScriptApplyDigitSubstitution ( const SCRIPT_DIGITSUBSTITUTE sds,
SCRIPT_CONTROL sc,
SCRIPT_STATE ss 
)

Definition at line 1275 of file usp10.c.

1277 {
1279 
1280  TRACE("%p, %p, %p\n", sds, sc, ss);
1281 
1282  if (!sc || !ss) return E_POINTER;
1283  if (!sds)
1284  {
1285  sds = &psds;
1287  return E_INVALIDARG;
1288  }
1289 
1291  sc->fContextDigits = 0;
1292  ss->fDigitSubstitute = 0;
1293 
1294  switch (sds->DigitSubstitute) {
1299  return S_OK;
1300  default:
1301  return E_INVALIDARG;
1302  }
1303 }
DWORD fContextDigits
Definition: usp10.h:94
#define LOCALE_USER_DEFAULT
#define E_INVALIDARG
Definition: ddrawi.h:101
#define SCRIPT_DIGITSUBSTITUTE_NONE
Definition: usp10.h:65
#define TRACE(s)
Definition: solgame.cpp:4
#define SCRIPT_DIGITSUBSTITUTE_NATIONAL
Definition: usp10.h:66
#define LANG_ENGLISH
Definition: nls.h:52
#define S_OK
Definition: intsafe.h:51
#define SCRIPT_DIGITSUBSTITUTE_CONTEXT
Definition: usp10.h:64
#define ss
Definition: i386-dis.c:432
#define E_POINTER
Definition: winerror.h:2365
HRESULT WINAPI ScriptRecordDigitSubstitution(LCID locale, SCRIPT_DIGITSUBSTITUTE *sds)
Definition: usp10.c:1209
DWORD uDefaultLanguage
Definition: usp10.h:93
#define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL
Definition: usp10.h:67

Referenced by enum_proc().

◆ ScriptApplyLogicalWidth()

HRESULT WINAPI ScriptApplyLogicalWidth ( const int dx,
int  num_chars,
int  num_glyphs,
const WORD log_clust,
const SCRIPT_VISATTR sva,
const int advance,
const SCRIPT_ANALYSIS sa,
ABC abc,
int justify 
)

Definition at line 4049 of file usp10.c.

4053 {
4054  int i;
4055 
4056  FIXME("(%p, %d, %d, %p, %p, %p, %p, %p, %p)\n",
4057  dx, num_chars, num_glyphs, log_clust, sva, advance, sa, abc, justify);
4058 
4059  for (i = 0; i < num_chars; i++) justify[i] = advance[i];
4060  return S_OK;
4061 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:111
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define S_OK
Definition: intsafe.h:51
GLint dx
Definition: linetemp.h:97
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

◆ ScriptBreak()

HRESULT WINAPI ScriptBreak ( const WCHAR chars,
int  count,
const SCRIPT_ANALYSIS sa,
SCRIPT_LOGATTR la 
)

Definition at line 3047 of file usp10.c.

3048 {
3049  TRACE("(%s, %d, %p, %p)\n", debugstr_wn(chars, count), count, sa, la);
3050 
3051  if (count < 0 || !la) return E_INVALIDARG;
3052  if (count == 0) return E_FAIL;
3053 
3054  BREAK_line(chars, count, sa, la);
3055 
3056  return S_OK;
3057 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define E_FAIL
Definition: ddrawi.h:102
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_wn
Definition: kernel32.h:33
void BREAK_line(const WCHAR *chars, int count, const SCRIPT_ANALYSIS *sa, SCRIPT_LOGATTR *la)
Definition: breaking.c:77
#define S_OK
Definition: intsafe.h:51
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

Referenced by EDIT_WordBreakProc(), ScriptStringAnalyse(), test_ScriptBreak(), and test_ScriptTextOut().

◆ ScriptCacheGetHeight()

HRESULT WINAPI ScriptCacheGetHeight ( HDC  hdc,
SCRIPT_CACHE psc,
LONG height 
)

Definition at line 3680 of file usp10.c.

3681 {
3682  HRESULT hr;
3683 
3684  TRACE("(%p, %p, %p)\n", hdc, psc, height);
3685 
3686  if (!height) return E_INVALIDARG;
3687  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
3688 
3690  return S_OK;
3691 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_INVALIDARG
Definition: ddrawi.h:101
static LONG get_cache_height(SCRIPT_CACHE *psc)
Definition: usp10.c:815
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
HDC hdc
Definition: main.c:9
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64

Referenced by test_script_cache_reuse(), and test_ScriptCacheGetHeight().

◆ ScriptCPtoX()

HRESULT WINAPI ScriptCPtoX ( int  iCP,
BOOL  fTrailing,
int  cChars,
int  cGlyphs,
const WORD pwLogClust,
const SCRIPT_VISATTR psva,
const int piAdvance,
const SCRIPT_ANALYSIS psa,
int piX 
)

Definition at line 2650 of file usp10.c.

2659 {
2660  int item;
2661  float iPosX;
2662  int iSpecial = -1;
2663  int iCluster = -1;
2664  int clust_size = 1;
2665  float special_size = 0.0;
2666  int iMaxPos = 0;
2667  int advance = 0;
2668  BOOL rtl = FALSE;
2669 
2670  TRACE("(%d,%d,%d,%d,%p,%p,%p,%p,%p)\n",
2671  iCP, fTrailing, cChars, cGlyphs, pwLogClust, psva, piAdvance,
2672  psa, piX);
2673 
2674  if (psa->fRTL && ! psa->fLogicalOrder)
2675  rtl = TRUE;
2676 
2677  if (fTrailing)
2678  iCP++;
2679 
2680  if (rtl)
2681  {
2682  int max_clust = pwLogClust[0];
2683 
2684  for (item=0; item < cGlyphs; item++)
2685  if (pwLogClust[item] > max_clust)
2686  {
2687  ERR("We do not handle non reversed clusters properly\n");
2688  break;
2689  }
2690 
2691  iMaxPos = 0;
2692  for (item = max_clust; item >=0; item --)
2693  iMaxPos += piAdvance[item];
2694  }
2695 
2696  iPosX = 0.0;
2697  for (item=0; item < iCP && item < cChars; item++)
2698  {
2699  if (iSpecial == -1 && (iCluster == -1 || iCluster+clust_size <= item))
2700  {
2701  int check;
2702  int clust = pwLogClust[item];
2703 
2704  iCluster = -1;
2705  clust_size = get_cluster_size(pwLogClust, cChars, item, 1, &iCluster,
2706  &check);
2707 
2708  advance = get_glyph_cluster_advance(piAdvance, psva, pwLogClust, cGlyphs, cChars, clust, 1);
2709 
2710  if (check >= cChars && !iMaxPos)
2711  {
2712  int glyph;
2713  for (glyph = clust; glyph < cGlyphs; glyph++)
2714  special_size += get_glyph_cluster_advance(piAdvance, psva, pwLogClust, cGlyphs, cChars, glyph, 1);
2715  iSpecial = item;
2716  special_size /= (cChars - item);
2717  iPosX += special_size;
2718  }
2719  else
2720  {
2722  {
2723  clust_size --;
2724  if (clust_size == 0)
2725  iPosX += advance;
2726  }
2727  else
2728  iPosX += advance / (float)clust_size;
2729  }
2730  }
2731  else if (iSpecial != -1)
2732  iPosX += special_size;
2733  else /* (iCluster != -1) */
2734  {
2735  int adv = get_glyph_cluster_advance(piAdvance, psva, pwLogClust, cGlyphs, cChars, pwLogClust[iCluster], 1);
2737  {
2738  clust_size --;
2739  if (clust_size == 0)
2740  iPosX += adv;
2741  }
2742  else
2743  iPosX += adv / (float)clust_size;
2744  }
2745  }
2746 
2747  if (iMaxPos > 0)
2748  {
2749  iPosX = iMaxPos - iPosX;
2750  if (iPosX < 0)
2751  iPosX = 0;
2752  }
2753 
2754  *piX = iPosX;
2755  TRACE("*piX=%d\n", *piX);
2756  return S_OK;
2757 }
SCRIPT_PROPERTIES props
static BOOL rtl
Definition: propsheet.c:36
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
#define TRUE
Definition: types.h:120
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
DWORD fNeedsCaretInfo
Definition: usp10.h:111
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
#define TRACE(s)
Definition: solgame.cpp:4
const scriptData scriptInformation[]
Definition: usp10.c:305
static int get_cluster_size(const WORD *pwLogClust, int cChars, int item, int direction, int *iCluster, int *check_out)
Definition: usp10.c:2594
void check(CONTEXT *pContext)
Definition: NtContinue.c:68
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
static ATOM item
Definition: dde.c:856
static float(__cdecl *square_half_float)(float x
static int get_glyph_cluster_advance(const int *piAdvance, const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cGlyphs, int cChars, int glyph, int direction)
Definition: usp10.c:2618
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64

Referenced by _test_item_ScriptXtoX(), ME_PointFromCharContext(), ScriptStringCPtoX(), ScriptStringXtoCP(), and test_ScriptTextOut().

◆ ScriptFreeCache()

HRESULT WINAPI ScriptFreeCache ( SCRIPT_CACHE psc)

Definition at line 1080 of file usp10.c.

1081 {
1082  TRACE("%p\n", psc);
1083 
1084  if (psc && *psc)
1085  {
1086  unsigned int i;
1087  INT n;
1088 
1090  if (--((ScriptCache *)*psc)->refcount > 0)
1091  {
1093  *psc = NULL;
1094  return S_OK;
1095  }
1096  list_remove(&((ScriptCache *)*psc)->entry);
1098 
1099  for (i = 0; i < GLYPH_MAX / GLYPH_BLOCK_SIZE; i++)
1100  {
1101  heap_free(((ScriptCache *)*psc)->widths[i]);
1102  }
1103  for (i = 0; i < NUM_PAGES; i++)
1104  {
1105  unsigned int j;
1106  if (((ScriptCache *)*psc)->page[i])
1107  for (j = 0; j < GLYPH_MAX / GLYPH_BLOCK_SIZE; j++)
1108  heap_free(((ScriptCache *)*psc)->page[i]->glyphs[j]);
1109  heap_free(((ScriptCache *)*psc)->page[i]);
1110  }
1111  heap_free(((ScriptCache *)*psc)->GSUB_Table);
1112  heap_free(((ScriptCache *)*psc)->GDEF_Table);
1113  heap_free(((ScriptCache *)*psc)->CMAP_Table);
1114  heap_free(((ScriptCache *)*psc)->GPOS_Table);
1115  for (n = 0; n < ((ScriptCache *)*psc)->script_count; n++)
1116  {
1117  int j;
1118  for (j = 0; j < ((ScriptCache *)*psc)->scripts[n].language_count; j++)
1119  {
1120  int k;
1121  for (k = 0; k < ((ScriptCache *)*psc)->scripts[n].languages[j].feature_count; k++)
1122  heap_free(((ScriptCache *)*psc)->scripts[n].languages[j].features[k].lookups);
1123  heap_free(((ScriptCache *)*psc)->scripts[n].languages[j].features);
1124  }
1125  for (j = 0; j < ((ScriptCache *)*psc)->scripts[n].default_language.feature_count; j++)
1126  heap_free(((ScriptCache *)*psc)->scripts[n].default_language.features[j].lookups);
1127  heap_free(((ScriptCache *)*psc)->scripts[n].default_language.features);
1128  heap_free(((ScriptCache *)*psc)->scripts[n].languages);
1129  }
1130  heap_free(((ScriptCache *)*psc)->scripts);
1131  heap_free(((ScriptCache *)*psc)->otm);
1132  heap_free(*psc);
1133  *psc = NULL;
1134  }
1135  return S_OK;
1136 }
static CRITICAL_SECTION cs_script_cache
Definition: usp10.c:681
GLdouble n
Definition: glext.h:7729
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
static UINT UINT LPWORD glyphs
Definition: font.c:44
int32_t INT
Definition: typedefs.h:58
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define GLYPH_BLOCK_SIZE
smooth NULL
Definition: ftsmooth.c:416
Definition: module.h:566
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
#define GLYPH_MAX
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
int k
Definition: mpi.c:3369
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define NUM_PAGES

Referenced by _test_shape_ok(), BIDI_Reorder(), ME_DestroyStyle(), ME_SetDefaultCharFormat(), ScriptStringAnalyse(), ScriptStringFree(), test_script_cache_reuse(), test_ScriptCacheGetHeight(), test_ScriptGetCMap(), test_ScriptGetFontFunctions(), test_ScriptGetFontProperties(), test_ScriptGetGlyphABCWidth(), test_ScriptItemIzeShapePlace(), test_ScriptPlace(), test_ScriptShape(), test_ScriptShapeOpenType(), test_ScriptTextOut(), test_ScriptTextOut2(), and test_ScriptTextOut3().

◆ ScriptGetCMap()

HRESULT WINAPI ScriptGetCMap ( HDC  hdc,
SCRIPT_CACHE psc,
const WCHAR pwcInChars,
int  cChars,
DWORD  dwFlags,
WORD pwOutGlyphs 
)

Definition at line 3554 of file usp10.c.

3556 {
3557  HRESULT hr;
3558  int i;
3559 
3560  TRACE("(%p,%p,%s,%d,0x%x,%p)\n", hdc, psc, debugstr_wn(pwcInChars, cChars),
3562 
3563  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
3564 
3565  hr = S_OK;
3566 
3567  for (i = 0; i < cChars; i++)
3568  {
3569  WCHAR inChar;
3570  if (dwFlags == SGCM_RTL)
3571  inChar = mirror_char(pwcInChars[i]);
3572  else
3573  inChar = pwcInChars[i];
3574  if (!(pwOutGlyphs[i] = get_cache_glyph(psc, inChar)))
3575  {
3576  WORD glyph;
3577  if (!hdc) return E_PENDING;
3578  if (GetGlyphIndicesW(hdc, &inChar, 1, &glyph, GGI_MARK_NONEXISTING_GLYPHS) == GDI_ERROR) return S_FALSE;
3579  if (glyph == 0xffff)
3580  {
3581  hr = S_FALSE;
3582  glyph = 0x0;
3583  }
3584  pwOutGlyphs[i] = set_cache_glyph(psc, inChar, glyph);
3585  }
3586  }
3587 
3588  return hr;
3589 }
HRESULT hr
Definition: shlfolder.c:183
static WORD set_cache_glyph(SCRIPT_CACHE *psc, WCHAR c, WORD glyph)
Definition: usp10.c:836
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define S_FALSE
Definition: winerror.h:2357
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned short WORD
Definition: ntddk_ex.h:93
#define GGI_MARK_NONEXISTING_GLYPHS
Definition: wingdi.h:1084
HDC hdc
Definition: main.c:9
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1175
#define SGCM_RTL
Definition: usp10.h:61
#define debugstr_wn
Definition: kernel32.h:33
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static WORD get_cache_glyph(SCRIPT_CACHE *psc, DWORD c)
Definition: usp10.c:825
static WCHAR mirror_char(WCHAR ch)
Definition: usp10.c:940
DWORD WINAPI GetGlyphIndicesW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpstr, _In_ int c, _Out_writes_(c) LPWORD pgi, _In_ DWORD fl)
#define E_PENDING
Definition: dinput.h:172
#define GDI_ERROR
Definition: wingdi.h:1308

Referenced by requires_fallback(), ScriptPlaceOpenType(), and test_ScriptGetCMap().

◆ ScriptGetFontFeatureTags()

HRESULT WINAPI ScriptGetFontFeatureTags ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
OPENTYPE_TAG  tagScript,
OPENTYPE_TAG  tagLangSys,
int  cMaxTags,
OPENTYPE_TAG pFeatureTags,
int pcTags 
)

Definition at line 4092 of file usp10.c.

4093 {
4094  HRESULT hr;
4095  if (!pFeatureTags || !pcTags || cMaxTags == 0) return E_INVALIDARG;
4096  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
4097 
4099 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_INVALIDARG
Definition: ddrawi.h:101
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG tagLangSys
Definition: usp10.c:64
LONG HRESULT
Definition: typedefs.h:79
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int OPENTYPE_TAG * pFeatureTags
Definition: usp10.c:68
HDC hdc
Definition: main.c:9
static SCRIPT_CACHE SCRIPT_ANALYSIS int cMaxTags
Definition: usp10.c:66
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
HRESULT SHAPE_GetFontFeatureTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int cMaxTags, OPENTYPE_TAG *pFeatureTags, int *pcTags)
Definition: shape.c:3523
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS int OPENTYPE_TAG int * pcTags
Definition: usp10.c:66

◆ ScriptGetFontLanguageTags()

HRESULT WINAPI ScriptGetFontLanguageTags ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
OPENTYPE_TAG  tagScript,
int  cMaxTags,
OPENTYPE_TAG pLangSysTags,
int pcTags 
)

Definition at line 4083 of file usp10.c.

4084 {
4085  HRESULT hr;
4086  if (!pLangSysTags || !pcTags || cMaxTags == 0) return E_INVALIDARG;
4087  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
4088 
4090 }
HRESULT hr
Definition: shlfolder.c:183
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_INVALIDARG
Definition: ddrawi.h:101
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG int OPENTYPE_TAG * pLangSysTags
Definition: usp10.c:67
LONG HRESULT
Definition: typedefs.h:79
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
Definition: usp10.c:64
HDC hdc
Definition: main.c:9
static SCRIPT_CACHE SCRIPT_ANALYSIS int cMaxTags
Definition: usp10.c:66
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
HRESULT SHAPE_GetFontLanguageTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, int cMaxTags, OPENTYPE_TAG *pLangSysTags, int *pcTags)
Definition: shape.c:3495
static SCRIPT_CACHE SCRIPT_ANALYSIS int OPENTYPE_TAG int * pcTags
Definition: usp10.c:66

◆ ScriptGetFontProperties()

HRESULT WINAPI ScriptGetFontProperties ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_FONTPROPERTIES sfp 
)

Definition at line 1176 of file usp10.c.

1177 {
1178  HRESULT hr;
1179 
1180  TRACE("%p,%p,%p\n", hdc, psc, sfp);
1181 
1182  if (!sfp) return E_INVALIDARG;
1183  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
1184 
1185  if (sfp->cBytes != sizeof(SCRIPT_FONTPROPERTIES))
1186  return E_INVALIDARG;
1187 
1189 
1190  return S_OK;
1191 }
HRESULT hr
Definition: shlfolder.c:183
static void get_cache_font_properties(SCRIPT_FONTPROPERTIES *sfp, ScriptCache *sc)
Definition: usp10.c:810
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
HDC hdc
Definition: main.c:9
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64

Referenced by test_ScriptGetFontProperties().

◆ ScriptGetFontScriptTags()

HRESULT WINAPI ScriptGetFontScriptTags ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
int  cMaxTags,
OPENTYPE_TAG pScriptTags,
int pcTags 
)

Definition at line 4074 of file usp10.c.

4075 {
4076  HRESULT hr;
4077  if (!pScriptTags || !pcTags || cMaxTags == 0) return E_INVALIDARG;
4078  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
4079 
4081 }
HRESULT hr
Definition: shlfolder.c:183
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG * pScriptTags
Definition: usp10.c:62
HRESULT SHAPE_GetFontScriptTags(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, int cMaxTags, OPENTYPE_TAG *pScriptTags, int *pcTags)
Definition: shape.c:3477
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_INVALIDARG
Definition: ddrawi.h:101
LONG HRESULT
Definition: typedefs.h:79
HDC hdc
Definition: main.c:9
static SCRIPT_CACHE SCRIPT_ANALYSIS int cMaxTags
Definition: usp10.c:66
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS int OPENTYPE_TAG int * pcTags
Definition: usp10.c:66

◆ ScriptGetGlyphABCWidth()

HRESULT WINAPI ScriptGetGlyphABCWidth ( HDC  hdc,
SCRIPT_CACHE psc,
WORD  glyph,
ABC abc 
)

Definition at line 3708 of file usp10.c.

3709 {
3710  HRESULT hr;
3711 
3712  TRACE("(%p, %p, 0x%04x, %p)\n", hdc, psc, glyph, abc);
3713 
3714  if (!abc) return E_INVALIDARG;
3715  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
3716 
3717  if (!get_cache_glyph_widths(psc, glyph, abc))
3718  {
3719  if (!hdc) return E_PENDING;
3721  {
3722  if (!GetCharABCWidthsI(hdc, 0, 1, &glyph, abc)) return S_FALSE;
3723  }
3724  else
3725  {
3726  INT width;
3727  if (!GetCharWidthI(hdc, glyph, 1, NULL, &width)) return S_FALSE;
3728  abc->abcB = width;
3729  abc->abcA = abc->abcC = 0;
3730  }
3731  set_cache_glyph_widths(psc, glyph, abc);
3732  }
3733  return S_OK;
3734 }
GLint GLint GLsizei width
Definition: gl.h:1546
static BOOL get_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
Definition: usp10.c:847
HRESULT hr
Definition: shlfolder.c:183
int abcC
Definition: wingdi.h:1412
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
int32_t INT
Definition: typedefs.h:58
BOOL WINAPI GetCharABCWidthsI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPABC pabc)
#define TMPF_TRUETYPE
Definition: wingdi.h:1312
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
UINT abcB
Definition: wingdi.h:1411
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
int abcA
Definition: wingdi.h:1410
static BOOL set_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
Definition: usp10.c:857
static BYTE get_cache_pitch_family(SCRIPT_CACHE *psc)
Definition: usp10.c:820
HDC hdc
Definition: main.c:9
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
BOOL WINAPI GetCharWidthI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPINT piWidths)
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
#define E_PENDING
Definition: dinput.h:172

Referenced by test_ScriptGetGlyphABCWidth().

◆ ScriptGetLogicalWidths()

HRESULT WINAPI ScriptGetLogicalWidths ( const SCRIPT_ANALYSIS sa,
int  nbchars,
int  nbglyphs,
const int advances,
const WORD log_clust,
const SCRIPT_VISATTR sva,
int widths 
)

Definition at line 3998 of file usp10.c.

4001 {
4002  int i, next = 0, direction;
4003 
4004  TRACE("(%p, %d, %d, %p, %p, %p, %p)\n",
4005  sa, nbchars, nbglyphs, advances, log_clust, sva, widths);
4006 
4007  if (sa->fRTL && !sa->fLogicalOrder)
4008  direction = -1;
4009  else
4010  direction = 1;
4011 
4012  for (i = 0; i < nbchars; i++)
4013  {
4014  int clust_size = get_cluster_size(log_clust, nbchars, i, direction, NULL, NULL);
4015  int advance = get_glyph_cluster_advance(advances, sva, log_clust, nbglyphs, nbchars, log_clust[i], direction);
4016  int j;
4017 
4018  for (j = 0; j < clust_size; j++)
4019  {
4020  widths[next] = advance / clust_size;
4021  next++;
4022  if (j) i++;
4023  }
4024  }
4025 
4026  return S_OK;
4027 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: solgame.cpp:4
static int get_cluster_size(const WORD *pwLogClust, int cChars, int item, int direction, int *iCluster, int *check_out)
Definition: usp10.c:2594
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define S_OK
Definition: intsafe.h:51
static unsigned __int64 next
Definition: rand_nt.c:6
static int get_glyph_cluster_advance(const int *piAdvance, const SCRIPT_VISATTR *pva, const WORD *pwLogClust, int cGlyphs, int cChars, int glyph, int direction)
Definition: usp10.c:2618
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

Referenced by test_ScriptGetLogicalWidths().

◆ ScriptGetProperties()

HRESULT WINAPI ScriptGetProperties ( const SCRIPT_PROPERTIES ***  props,
int num 
)

Definition at line 1154 of file usp10.c.

1155 {
1156  TRACE("(%p,%p)\n", props, num);
1157 
1158  if (!props && !num) return E_INVALIDARG;
1159 
1160  if (num) *num = ARRAY_SIZE(script_props);
1161  if (props) *props = script_props;
1162 
1163  return S_OK;
1164 }
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
GLuint GLuint num
Definition: glext.h:9618
static const SCRIPT_PROPERTIES * script_props[]
Definition: usp10.c:636
#define S_OK
Definition: intsafe.h:51
#define ARRAY_SIZE(a)
Definition: main.h:24
static const WCHAR props[]
Definition: wbemdisp.c:288

Referenced by _test_shape_ok(), test_ScriptGetProperties(), test_ScriptItemIzeShapePlace(), and test_ScriptXtoX().

◆ ScriptIsComplex()

HRESULT WINAPI ScriptIsComplex ( const WCHAR chars,
int  len,
DWORD  flag 
)

Definition at line 3074 of file usp10.c.

3075 {
3076  enum usp10_script script;
3077  unsigned int i, consumed;
3078 
3079  TRACE("(%s,%d,0x%x)\n", debugstr_wn(chars, len), len, flag);
3080 
3081  if (!chars || len < 0)
3082  return E_INVALIDARG;
3083 
3084  for (i = 0; i < len; i+=consumed)
3085  {
3086  if ((flag & SIC_ASCIIDIGIT) && chars[i] >= 0x30 && chars[i] <= 0x39)
3087  return S_OK;
3088 
3089  script = get_char_script(chars,i,len, &consumed);
3090  if ((scriptInformation[script].props.fComplex && (flag & SIC_COMPLEX))||
3092  return S_OK;
3093  }
3094  return S_FALSE;
3095 }
SCRIPT_PROPERTIES props
#define SIC_ASCIIDIGIT
Definition: usp10.h:57
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define SIC_NEUTRAL
Definition: usp10.h:58
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
script
Definition: msipriv.h:374
DWORD fComplex
Definition: usp10.h:109
#define TRACE(s)
Definition: solgame.cpp:4
const scriptData scriptInformation[]
Definition: usp10.c:305
#define SIC_COMPLEX
Definition: usp10.h:56
static enum usp10_script get_char_script(const WCHAR *str, unsigned int index, unsigned int end, unsigned int *consumed)
Definition: usp10.c:969
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_wn
Definition: kernel32.h:33
#define S_OK
Definition: intsafe.h:51
int consumed
Definition: scanf.h:134
static const WCHAR props[]
Definition: wbemdisp.c:288
usp10_script

Referenced by LPK_DrawUnderscore(), LpkExtTextOut(), LpkGetTextExtentExPoint(), and test_ScriptIsComplex().

◆ ScriptItemize()

HRESULT WINAPI ScriptItemize ( const WCHAR pwcInChars,
int  cInChars,
int  cMaxItems,
const SCRIPT_CONTROL psControl,
const SCRIPT_STATE psState,
SCRIPT_ITEM pItems,
int pcItems 
)

Definition at line 1853 of file usp10.c.

1856 {
1858 }
static int cInChars
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
smooth NULL
Definition: ftsmooth.c:416
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM * pItems
Definition: usp10.c:62
static int int const SCRIPT_CONTROL * psControl
Definition: usp10.c:62
static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, OPENTYPE_TAG *pScriptTags, int *pcItems)
Definition: usp10.c:1344
static int int cMaxItems
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE * psState
Definition: usp10.c:62

Referenced by _test_items_ok(), BIDI_Reorder(), itemize_para(), ScriptStringAnalyse(), test_newlines(), test_ScriptBreak(), test_ScriptGetFontFunctions(), test_ScriptItemize(), test_ScriptItemize_surrogates(), test_ScriptItemIzeShapePlace(), test_ScriptPlace(), test_ScriptShape(), test_ScriptTextOut(), test_ScriptTextOut2(), test_ScriptTextOut3(), and test_ScriptXtoX().

◆ ScriptItemizeOpenType()

HRESULT WINAPI ScriptItemizeOpenType ( const WCHAR pwcInChars,
int  cInChars,
int  cMaxItems,
const SCRIPT_CONTROL psControl,
const SCRIPT_STATE psState,
SCRIPT_ITEM pItems,
OPENTYPE_TAG pScriptTags,
int pcItems 
)

Definition at line 1828 of file usp10.c.

1831 {
1833 }
static int cInChars
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG * pScriptTags
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM ULONG int * pcItems
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE SCRIPT_ITEM * pItems
Definition: usp10.c:62
static int int const SCRIPT_CONTROL * psControl
Definition: usp10.c:62
static HRESULT _ItemizeInternal(const WCHAR *pwcInChars, int cInChars, int cMaxItems, const SCRIPT_CONTROL *psControl, const SCRIPT_STATE *psState, SCRIPT_ITEM *pItems, OPENTYPE_TAG *pScriptTags, int *pcItems)
Definition: usp10.c:1344
static int int cMaxItems
Definition: usp10.c:62
static int int const SCRIPT_CONTROL const SCRIPT_STATE * psState
Definition: usp10.c:62

◆ ScriptJustify()

HRESULT WINAPI ScriptJustify ( const SCRIPT_VISATTR sva,
const int advance,
int  num_glyphs,
int  dx,
int  min_kashida,
int justify 
)

Definition at line 4063 of file usp10.c.

4065 {
4066  int i;
4067 
4068  FIXME("(%p, %p, %d, %d, %d, %p)\n", sva, advance, num_glyphs, dx, min_kashida, justify);
4069 
4070  for (i = 0; i < num_glyphs; i++) justify[i] = advance[i];
4071  return S_OK;
4072 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:111
_STLP_MOVE_TO_STD_NAMESPACE void _STLP_CALL advance(_InputIterator &__i, _Distance __n)
#define S_OK
Definition: intsafe.h:51
GLint dx
Definition: linetemp.h:97

◆ ScriptLayout()

HRESULT WINAPI ScriptLayout ( int  runs,
const BYTE level,
int vistolog,
int logtovis 
)

Definition at line 3752 of file usp10.c.

3753 {
3754  int* indexs;
3755  int ich;
3756 
3757  TRACE("(%d, %p, %p, %p)\n", runs, level, vistolog, logtovis);
3758 
3759  if (!level || (!vistolog && !logtovis))
3760  return E_INVALIDARG;
3761 
3762  if (!(indexs = heap_calloc(runs, sizeof(*indexs))))
3763  return E_OUTOFMEMORY;
3764 
3765  if (vistolog)
3766  {
3767  for( ich = 0; ich < runs; ich++)
3768  indexs[ich] = ich;
3769 
3770  ich = 0;
3771  while (ich < runs)
3772  ich += BIDI_ReorderV2lLevel(0, indexs+ich, level+ich, runs - ich, FALSE);
3773  memcpy(vistolog, indexs, runs * sizeof(*vistolog));
3774  }
3775 
3776  if (logtovis)
3777  {
3778  for( ich = 0; ich < runs; ich++)
3779  indexs[ich] = ich;
3780 
3781  ich = 0;
3782  while (ich < runs)
3783  ich += BIDI_ReorderL2vLevel(0, indexs+ich, level+ich, runs - ich, FALSE);
3784  memcpy(logtovis, indexs, runs * sizeof(*logtovis));
3785  }
3786  heap_free(indexs);
3787 
3788  return S_OK;
3789 }
GLint level
Definition: gl.h:1546
int BIDI_ReorderL2vLevel(int level, int *pIndexs, const BYTE *plevel, int cch, BOOL fReverse)
Definition: bidi.c:1215
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define E_INVALIDARG
Definition: ddrawi.h:101
#define TRACE(s)
Definition: solgame.cpp:4
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
int BIDI_ReorderV2lLevel(int level, int *pIndexs, const BYTE *plevel, int cch, BOOL fReverse)
Definition: bidi.c:1188
#define S_OK
Definition: intsafe.h:51
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by BIDI_Reorder(), BidiLines(), layout_row(), ScriptStringAnalyse(), and test_ScriptLayout().

◆ ScriptPlace()

HRESULT WINAPI ScriptPlace ( HDC  hdc,
SCRIPT_CACHE psc,
const WORD pwGlyphs,
int  cGlyphs,
const SCRIPT_VISATTR psva,
SCRIPT_ANALYSIS psa,
int piAdvance,
GOFFSET pGoffset,
ABC pABC 
)

Definition at line 3510 of file usp10.c.

3513 {
3514  HRESULT hr;
3515  SCRIPT_GLYPHPROP *glyphProps;
3516  int i;
3517 
3518  TRACE("(%p, %p, %p, %d, %p, %p, %p, %p, %p)\n", hdc, psc, pwGlyphs, cGlyphs, psva, psa,
3519  piAdvance, pGoffset, pABC);
3520 
3521  if (!psva) return E_INVALIDARG;
3522  if (!pGoffset) return E_FAIL;
3523 
3524  if (!(glyphProps = heap_calloc(cGlyphs, sizeof(*glyphProps))))
3525  return E_OUTOFMEMORY;
3526 
3527  for (i = 0; i < cGlyphs; i++)
3528  glyphProps[i].sva = psva[i];
3529 
3530  hr = ScriptPlaceOpenType(hdc, psc, psa, scriptInformation[psa->eScript].scriptTag, 0, NULL, NULL, 0, NULL, NULL, NULL, 0, pwGlyphs, glyphProps, cGlyphs, piAdvance, pGoffset, pABC);
3531 
3532  heap_free(glyphProps);
3533 
3534  return hr;
3535 }
HRESULT hr
Definition: shlfolder.c:183
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
#define E_FAIL
Definition: ddrawi.h:102
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
OPENTYPE_TAG scriptTag
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
const scriptData scriptInformation[]
Definition: usp10.c:305
LONG HRESULT
Definition: typedefs.h:79
HDC hdc
Definition: main.c:9
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
HRESULT WINAPI ScriptPlaceOpenType(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, int cChars, const WORD *pwGlyphs, const SCRIPT_GLYPHPROP *pGlyphProps, int cGlyphs, int *piAdvance, GOFFSET *pGoffset, ABC *pABC)
Definition: usp10.c:3387
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ScriptStringAnalyse(), shape_run(), test_ScriptItemIzeShapePlace(), test_ScriptPlace(), test_ScriptTextOut(), test_ScriptTextOut2(), and test_ScriptTextOut3().

◆ ScriptPlaceOpenType()

HRESULT WINAPI ScriptPlaceOpenType ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
OPENTYPE_TAG  tagScript,
OPENTYPE_TAG  tagLangSys,
int rcRangeChars,
TEXTRANGE_PROPERTIES **  rpRangeProperties,
int  cRanges,
const WCHAR pwcChars,
WORD pwLogClust,
SCRIPT_CHARPROP pCharProps,
int  cChars,
const WORD pwGlyphs,
const SCRIPT_GLYPHPROP pGlyphProps,
int  cGlyphs,
int piAdvance,
GOFFSET pGoffset,
ABC pABC 
)

Definition at line 3387 of file usp10.c.

3396 {
3397  HRESULT hr;
3398  int i;
3399  static int once = 0;
3400 
3401  TRACE("(%p, %p, %p, %s, %s, %p, %p, %d, %s, %p, %p, %d, %p, %p, %d, %p %p %p)\n",
3402  hdc, psc, psa,
3403  debugstr_an((char*)&tagScript,4), debugstr_an((char*)&tagLangSys,4),
3405  pwLogClust, pCharProps, cChars, pwGlyphs, pGlyphProps, cGlyphs, piAdvance,
3406  pGoffset, pABC);
3407 
3408  if (!pGlyphProps) return E_INVALIDARG;
3409  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
3410  if (!pGoffset) return E_FAIL;
3411 
3412  if (cRanges)
3413  if (!once++) FIXME("Ranges not supported yet\n");
3414 
3415  ((ScriptCache *)*psc)->userScript = tagScript;
3416  ((ScriptCache *)*psc)->userLang = tagLangSys;
3417 
3418  if (pABC) memset(pABC, 0, sizeof(ABC));
3419  for (i = 0; i < cGlyphs; i++)
3420  {
3421  WORD glyph;
3422  ABC abc;
3423 
3424  /* FIXME: set to more reasonable values */
3425  pGoffset[i].du = pGoffset[i].dv = 0;
3426 
3427  if (pGlyphProps[i].sva.fZeroWidth)
3428  {
3429  abc.abcA = abc.abcB = abc.abcC = 0;
3430  if (piAdvance) piAdvance[i] = 0;
3431  continue;
3432  }
3433 
3434  if (psa->fNoGlyphIndex)
3435  {
3436  if (FAILED(hr = ScriptGetCMap(hdc, psc, &pwGlyphs[i], 1, 0, &glyph))) return hr;
3437  }
3438  else
3439  {
3440  hr = S_OK;
3441  glyph = pwGlyphs[i];
3442  }
3443 
3444  if (hr == S_FALSE)
3445  {
3446  if (!hdc) return E_PENDING;
3448  {
3449  if (!GetCharABCWidthsW(hdc, pwGlyphs[i], pwGlyphs[i], &abc)) return S_FALSE;
3450  }
3451  else
3452  {
3453  INT width;
3454  if (!GetCharWidthW(hdc, pwGlyphs[i], pwGlyphs[i], &width)) return S_FALSE;
3455  abc.abcB = width;
3456  abc.abcA = abc.abcC = 0;
3457  }
3458  }
3459  else if (!get_cache_glyph_widths(psc, glyph, &abc))
3460  {
3461  if (!hdc) return E_PENDING;
3463  {
3464  if (!GetCharABCWidthsI(hdc, glyph, 1, NULL, &abc)) return S_FALSE;
3465  }
3466  else
3467  {
3468  INT width;
3469  if (!GetCharWidthI(hdc, glyph, 1, NULL, &width)) return S_FALSE;
3470  abc.abcB = width;
3471  abc.abcA = abc.abcC = 0;
3472  }
3473  set_cache_glyph_widths(psc, glyph, &abc);
3474  }
3475  if (pABC)
3476  {
3477  pABC->abcA += abc.abcA;
3478  pABC->abcB += abc.abcB;
3479  pABC->abcC += abc.abcC;
3480  }
3481  if (piAdvance) piAdvance[i] = abc.abcA + abc.abcB + abc.abcC;
3482  }
3483 
3484  SHAPE_ApplyOpenTypePositions(hdc, (ScriptCache *)*psc, psa, pwGlyphs, cGlyphs, piAdvance, pGoffset);
3485 
3486  if (pABC) TRACE("Total for run: abcA=%d, abcB=%d, abcC=%d\n", pABC->abcA, pABC->abcB, pABC->abcC);
3487  return S_OK;
3488 }
BOOL WINAPI GetCharWidthW(_In_ HDC hdc, _In_ UINT iFirst, _In_ UINT iLast, _Out_writes_(iLast+1 - iFirst) LPINT lpBuffer)
GLint GLint GLsizei width
Definition: gl.h:1546
static BOOL get_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
Definition: usp10.c:847
Definition: wingdi.h:1409
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP * pCharProps
Definition: usp10.c:64
HRESULT hr
Definition: shlfolder.c:183
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
int abcC
Definition: wingdi.h:1412
_In_ FONTOBJ _In_ ULONG _In_ ULONG cGlyphs
Definition: winddi.h:3799
LONG du
Definition: usp10.h:200
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
#define E_FAIL
Definition: ddrawi.h:102
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int * rcRangeChars
Definition: usp10.c:64
int32_t INT
Definition: typedefs.h:58
void SHAPE_ApplyOpenTypePositions(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WORD *pwGlyphs, INT cGlyphs, int *piAdvance, GOFFSET *pGoffset)
Definition: shape.c:3429
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL WINAPI GetCharABCWidthsI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPABC pabc)
#define TMPF_TRUETYPE
Definition: wingdi.h:1312
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG tagLangSys
Definition: usp10.c:64
LONG dv
Definition: usp10.h:201
UINT abcB
Definition: wingdi.h:1411
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
int abcA
Definition: wingdi.h:1410
unsigned short WORD
Definition: ntddk_ex.h:93
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
Definition: usp10.c:64
static BOOL set_cache_glyph_widths(SCRIPT_CACHE *psc, WORD glyph, ABC *abc)
Definition: usp10.c:857
static BYTE get_cache_pitch_family(SCRIPT_CACHE *psc)
Definition: usp10.c:820
HDC hdc
Definition: main.c:9
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
HRESULT WINAPI ScriptGetCMap(HDC hdc, SCRIPT_CACHE *psc, const WCHAR *pwcInChars, int cChars, DWORD dwFlags, WORD *pwOutGlyphs)
Definition: usp10.c:3554
#define debugstr_wn
Definition: kernel32.h:33
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR * pwcChars
Definition: usp10.c:64
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES ** rpRangeProperties
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int cRanges
Definition: usp10.c:64
BOOL WINAPI GetCharWidthI(_In_ HDC hdc, _In_ UINT giFirst, _In_ UINT cgi, _In_reads_opt_(cgi) LPWORD pgi, _Out_writes_(cgi) LPINT piWidths)
BOOL WINAPI GetCharABCWidthsW(_In_ HDC hdc, _In_ UINT wFirst, _In_ UINT wLast, _Out_writes_(wLast - wFirst+1) LPABC lpABC)
static UINT UINT LPWORD LPABC abc
Definition: font.c:44
#define E_PENDING
Definition: dinput.h:172
#define memset(x, y, z)
Definition: compat.h:39

Referenced by ScriptPlace().

◆ ScriptRecordDigitSubstitution()

HRESULT WINAPI ScriptRecordDigitSubstitution ( LCID  locale,
SCRIPT_DIGITSUBSTITUTE sds 
)

Definition at line 1209 of file usp10.c.

1210 {
1211  DWORD plgid, sub;
1212 
1213  TRACE("0x%x, %p\n", locale, sds);
1214 
1215  /* This implementation appears to be correct for all languages, but it's
1216  * not clear if sds->DigitSubstitute is ever set to anything except
1217  * CONTEXT or NONE in reality */
1218 
1219  if (!sds) return E_POINTER;
1220 
1222 
1224  return E_INVALIDARG;
1225 
1227  sds->TraditionalDigitLanguage = plgid;
1228 
1229  if (plgid == LANG_ARABIC || plgid == LANG_FARSI)
1230  sds->NationalDigitLanguage = plgid;
1231  else
1233 
1234  if (!GetLocaleInfoW(locale, LOCALE_IDIGITSUBSTITUTION | LOCALE_RETURN_NUMBER,
1235  (WCHAR *)&sub, sizeof(sub) / sizeof(WCHAR)))
1236  return E_INVALIDARG;
1237 
1238  switch (sub)
1239  {
1240  case 0:
1241  if (plgid == LANG_ARABIC || plgid == LANG_FARSI)
1243  else
1245  break;
1246  case 1:
1248  break;
1249  case 2:
1251  break;
1252  default:
1254  break;
1255  }
1256 
1257  sds->dwReserved = 0;
1258  return S_OK;
1259 }
#define LANG_ARABIC
Definition: nls.h:29
#define LCID_INSTALLED
Definition: winnls.h:198
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
Definition: lang.c:1098
LCID WINAPI ConvertDefaultLocale(LCID lcid)
Definition: lang.c:1502
Definition: _locale.h:75
#define E_INVALIDARG
Definition: ddrawi.h:101
#define SCRIPT_DIGITSUBSTITUTE_NONE
Definition: usp10.h:65
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
DWORD TraditionalDigitLanguage
Definition: usp10.h:156
#define SCRIPT_DIGITSUBSTITUTE_NATIONAL
Definition: usp10.h:66
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LANG_ENGLISH
Definition: nls.h:52
BOOL WINAPI IsValidLocale(LCID lcid, DWORD flags)
Definition: lang.c:1548
#define LANGIDFROMLCID(l)
Definition: nls.h:18
#define S_OK
Definition: intsafe.h:51
#define LANG_FARSI
Definition: nls.h:55
#define SCRIPT_DIGITSUBSTITUTE_CONTEXT
Definition: usp10.h:64
#define E_POINTER
Definition: winerror.h:2365
#define SCRIPT_DIGITSUBSTITUTE_TRADITIONAL
Definition: usp10.h:67
#define PRIMARYLANGID(l)
Definition: nls.h:16

Referenced by enum_proc(), and ScriptApplyDigitSubstitution().

◆ ScriptShape()

HRESULT WINAPI ScriptShape ( HDC  hdc,
SCRIPT_CACHE psc,
const WCHAR pwcChars,
int  cChars,
int  cMaxGlyphs,
SCRIPT_ANALYSIS psa,
WORD pwOutGlyphs,
WORD pwLogClust,
SCRIPT_VISATTR psva,
int pcGlyphs 
)

Definition at line 3321 of file usp10.c.

3325 {
3326  HRESULT hr;
3327  int i;
3328  SCRIPT_CHARPROP *charProps;
3329  SCRIPT_GLYPHPROP *glyphProps;
3330 
3331  if (!psva || !pcGlyphs) return E_INVALIDARG;
3332  if (cChars > cMaxGlyphs) return E_OUTOFMEMORY;
3333 
3334  if (!(charProps = heap_calloc(cChars, sizeof(*charProps))))
3335  return E_OUTOFMEMORY;
3336 
3337  if (!(glyphProps = heap_calloc(cMaxGlyphs, sizeof(*glyphProps))))
3338  {
3339  heap_free(charProps);
3340  return E_OUTOFMEMORY;
3341  }
3342 
3344 
3345  if (SUCCEEDED(hr))
3346  {
3347  for (i = 0; i < *pcGlyphs; i++)
3348  psva[i] = glyphProps[i].sva;
3349  }
3350 
3351  heap_free(charProps);
3352  heap_free(glyphProps);
3353 
3354  return hr;
3355 }
HRESULT hr
Definition: shlfolder.c:183
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
OPENTYPE_TAG scriptTag
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
smooth NULL
Definition: ftsmooth.c:416
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
const scriptData scriptInformation[]
Definition: usp10.c:305
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROP int * pcGlyphs
Definition: usp10.c:64
LONG HRESULT
Definition: typedefs.h:79
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int cMaxGlyphs
Definition: usp10.c:64
HDC hdc
Definition: main.c:9
HRESULT WINAPI ScriptShapeOpenType(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_ANALYSIS *psa, OPENTYPE_TAG tagScript, OPENTYPE_TAG tagLangSys, int *rcRangeChars, TEXTRANGE_PROPERTIES **rpRangeProperties, int cRanges, const WCHAR *pwcChars, int cChars, int cMaxGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProps, WORD *pwOutGlyphs, SCRIPT_GLYPHPROP *pOutGlyphProps, int *pcGlyphs)
Definition: usp10.c:3124
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR * pwcChars
Definition: usp10.c:64
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
#define SUCCEEDED(hr)
Definition: intsafe.h:49
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by BIDI_Reorder(), ScriptStringAnalyse(), shape_run(), test_ScriptItemIzeShapePlace(), test_ScriptPlace(), test_ScriptShape(), test_ScriptTextOut(), test_ScriptTextOut2(), and test_ScriptTextOut3().

◆ ScriptShapeOpenType()

HRESULT WINAPI ScriptShapeOpenType ( HDC  hdc,
SCRIPT_CACHE psc,
SCRIPT_ANALYSIS psa,
OPENTYPE_TAG  tagScript,
OPENTYPE_TAG  tagLangSys,
int rcRangeChars,
TEXTRANGE_PROPERTIES **  rpRangeProperties,
int  cRanges,
const WCHAR pwcChars,
int  cChars,
int  cMaxGlyphs,
WORD pwLogClust,
SCRIPT_CHARPROP pCharProps,
WORD pwOutGlyphs,
SCRIPT_GLYPHPROP pOutGlyphProps,
int pcGlyphs 
)

Definition at line 3124 of file usp10.c.

3132 {
3133  HRESULT hr;
3134  int i;
3135  unsigned int g;
3136  BOOL rtl;
3137  int cluster;
3138  static int once = 0;
3139 
3140  TRACE("(%p, %p, %p, %s, %s, %p, %p, %d, %s, %d, %d, %p, %p, %p, %p, %p )\n",
3141  hdc, psc, psa,
3142  debugstr_an((char*)&tagScript,4), debugstr_an((char*)&tagLangSys,4),
3145 
3146  if (psa) TRACE("psa values: %d, %d, %d, %d, %d, %d, %d\n", psa->eScript, psa->fRTL, psa->fLayoutRTL,
3147  psa->fLinkBefore, psa->fLinkAfter, psa->fLogicalOrder, psa->fNoGlyphIndex);
3148 
3149  if (!pOutGlyphProps || !pcGlyphs || !pCharProps) return E_INVALIDARG;
3150  if (cChars > cMaxGlyphs) return E_OUTOFMEMORY;
3151 
3152  if (cRanges)
3153  if(!once++) FIXME("Ranges not supported yet\n");
3154 
3155  rtl = (psa && !psa->fLogicalOrder && psa->fRTL);
3156 
3157  *pcGlyphs = cChars;
3158  if ((hr = init_script_cache(hdc, psc)) != S_OK) return hr;
3159  if (!pwLogClust) return E_FAIL;
3160 
3161  ((ScriptCache *)*psc)->userScript = tagScript;
3162  ((ScriptCache *)*psc)->userLang = tagLangSys;
3163 
3164  /* Initialize a SCRIPT_VISATTR and LogClust for each char in this run */
3165  for (i = 0; i < cChars; i++)
3166  {
3167  int idx = i;
3168  if (rtl) idx = cChars - 1 - i;
3169  /* FIXME: set to better values */
3170  pOutGlyphProps[i].sva.uJustification = (pwcChars[idx] == ' ') ? SCRIPT_JUSTIFY_BLANK : SCRIPT_JUSTIFY_CHARACTER;
3171  pOutGlyphProps[i].sva.fClusterStart = 1;
3172  pOutGlyphProps[i].sva.fDiacritic = 0;
3173  pOutGlyphProps[i].sva.fZeroWidth = 0;
3174  pOutGlyphProps[i].sva.fReserved = 0;
3175  pOutGlyphProps[i].sva.fShapeReserved = 0;
3176 
3177  /* FIXME: have the shaping engine set this */
3178  pCharProps[i].fCanGlyphAlone = 0;
3179 
3180  pwLogClust[i] = idx;
3181  }
3182 
3183  if (psa && !psa->fNoGlyphIndex && ((ScriptCache *)*psc)->sfnt)
3184  {
3185  WCHAR *rChars;
3186  if ((hr = SHAPE_CheckFontForRequiredFeatures(hdc, (ScriptCache *)*psc, psa)) != S_OK) return hr;
3187 
3188  if (!(rChars = heap_calloc(cChars, sizeof(*rChars))))
3189  return E_OUTOFMEMORY;
3190 
3191  for (i = 0, g = 0, cluster = 0; i < cChars; i++)
3192  {
3193  int idx = i;
3194  DWORD chInput;
3195 
3196  if (rtl) idx = cChars - 1 - i;
3197  if (!cluster)
3198  {
3200  if (!chInput)
3201  {
3202  if (psa->fRTL)
3203  chInput = mirror_char(pwcChars[idx]);
3204  else
3205  chInput = pwcChars[idx];
3206  rChars[i] = chInput;
3207  }
3208  else
3209  {
3210  rChars[i] = pwcChars[idx];
3211  rChars[i+1] = pwcChars[(rtl)?idx-1:idx+1];
3212  cluster = 1;
3213  }
3214  if (!(pwOutGlyphs[g] = get_cache_glyph(psc, chInput)))
3215  {
3216  WORD glyph;
3217  if (!hdc)
3218  {
3219  heap_free(rChars);
3220  return E_PENDING;
3221  }
3222  if (OpenType_CMAP_GetGlyphIndex(hdc, (ScriptCache *)*psc, chInput, &glyph, 0) == GDI_ERROR)
3223  {
3224  heap_free(rChars);
3225  return S_FALSE;
3226  }
3227  pwOutGlyphs[g] = set_cache_glyph(psc, chInput, glyph);
3228  }
3229  g++;
3230  }
3231  else
3232  {
3233  int k;
3234  cluster--;
3236  for (k = (rtl)?idx-1:idx+1; k >= 0 && k < cChars; (rtl)?k--:k++)
3237  pwLogClust[k]--;
3238  }
3239  }
3240  *pcGlyphs = g;
3241 
3245 
3246  for (i = 0; i < cChars; ++i)
3247  {
3248  /* Special case for tabs and joiners. As control characters, ZWNJ
3249  * and ZWJ would in principle get handled by the corresponding
3250  * shaping functions. However, since ZWNJ and ZWJ can get merged
3251  * into adjoining runs during itemisation, these don't generally
3252  * get classified as Script_Control. */
3253  if (pwcChars[i] == 0x0009 || pwcChars[i] == ZWSP || pwcChars[i] == ZWNJ || pwcChars[i] == ZWJ)
3254  {
3255  pwOutGlyphs[pwLogClust[i]] = ((ScriptCache *)*psc)->sfp.wgBlank;
3256  pOutGlyphProps[pwLogClust[i]].sva.fZeroWidth = 1;
3257  }
3258  }
3259  heap_free(rChars);
3260  }
3261  else
3262  {
3263  TRACE("no glyph translation\n");
3264  for (i = 0; i < cChars; i++)
3265  {
3266  int idx = i;
3267  /* No mirroring done here */
3268  if (rtl) idx = cChars - 1 - i;
3269  pwOutGlyphs[i] = pwcChars[idx];
3270 
3271  if (!psa)
3272  continue;
3273 
3274  /* overwrite some basic control glyphs to blank */
3275  if (psa->fNoGlyphIndex)
3276  {
3277  if (pwcChars[idx] == ZWSP || pwcChars[idx] == ZWNJ || pwcChars[idx] == ZWJ)
3278  {
3279  pwOutGlyphs[i] = 0x20;
3280  pOutGlyphProps[i].sva.fZeroWidth = 1;
3281  }
3282  }
3283  else if (psa->eScript == Script_Control || pwcChars[idx] == ZWSP
3284  || pwcChars[idx] == ZWNJ || pwcChars[idx] == ZWJ)
3285  {
3286  if (pwcChars[idx] == 0x0009 || pwcChars[idx] == 0x000A ||
3287  pwcChars[idx] == 0x000D || pwcChars[idx] >= 0x001C)
3288  {
3289  pwOutGlyphs[i] = ((ScriptCache *)*psc)->sfp.wgBlank;
3290  pOutGlyphProps[i].sva.fZeroWidth = 1;
3291  }
3292  }
3293  }
3294  }
3295 
3296  return S_OK;
3297 }
static BOOL rtl
Definition: propsheet.c:36
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP * pCharProps
Definition: usp10.c:64
HRESULT hr
Definition: shlfolder.c:183
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD * pwLogClust
Definition: usp10.c:64
static WORD set_cache_glyph(SCRIPT_CACHE *psc, WCHAR c, WORD glyph)
Definition: usp10.c:836
SFNT_Service sfnt
Definition: ttdriver.c:206
static HRESULT init_script_cache(const HDC hdc, SCRIPT_CACHE *psc)
Definition: usp10.c:866
static void * heap_calloc(SIZE_T count, SIZE_T size)
Definition: heap.h:49
HRESULT SHAPE_CheckFontForRequiredFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa)
Definition: shape.c:3454
#define E_FAIL
Definition: ddrawi.h:102
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int * rcRangeChars
Definition: usp10.c:64
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
unsigned int idx
Definition: utils.c:41
#define ZWSP
#define S_FALSE
Definition: winerror.h:2357
#define E_INVALIDARG
Definition: ddrawi.h:101
void SHAPE_ApplyDefaultOpentypeFeatures(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, INT cChars, WORD *pwLogClust)
Definition: shape.c:3421
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG tagLangSys
Definition: usp10.c:64
void SHAPE_ContextualShaping(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WCHAR *pwcChars, INT cChars, WORD *pwOutGlyphs, INT *pcGlyphs, INT cMaxGlyphs, WORD *pwLogClust)
Definition: shape.c:3388
static DWORD decode_surrogate_pair(const WCHAR *str, unsigned int index, unsigned int end)
Definition: usp10.c:946
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int cChars
Definition: usp10.c:64
GLboolean GLboolean g
Definition: glext.h:6204
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROP int * pcGlyphs
Definition: usp10.c:64
LONG HRESULT
Definition: typedefs.h:79
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int cMaxGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD SCRIPT_GLYPHPROP * pOutGlyphProps
Definition: usp10.c:64
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG tagScript
Definition: usp10.c:64
HDC hdc
Definition: main.c:9
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
#define ZWNJ
#define debugstr_wn
Definition: kernel32.h:33
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR int int WORD SCRIPT_CHARPROP WORD * pwOutGlyphs
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int const WCHAR * pwcChars
Definition: usp10.c:64
DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, WORD *glyph_index, DWORD flags)
Definition: opentype.c:673
#define S_OK
Definition: intsafe.h:51
static SCRIPT_CACHE * psc
Definition: usp10.c:64
static WORD get_cache_glyph(SCRIPT_CACHE *psc, DWORD c)
Definition: usp10.c:825
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES ** rpRangeProperties
Definition: usp10.c:64
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
static WCHAR mirror_char(WCHAR ch)
Definition: usp10.c:940
static SCRIPT_CACHE SCRIPT_ANALYSIS OPENTYPE_TAG OPENTYPE_TAG int TEXTRANGE_PROPERTIES int cRanges
Definition: usp10.c:64
#define E_PENDING
Definition: dinput.h:172
#define GDI_ERROR
Definition: wingdi.h:1308
int k
Definition: mpi.c:3369
void SHAPE_CharGlyphProp(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, const WCHAR *pwcChars, const INT cChars, const WORD *pwGlyphs, const INT cGlyphs, WORD *pwLogClust, SCRIPT_CHARPROP *pCharProp, SCRIPT_GLYPHPROP *pGlyphProp)
Definition: shape.c:3378
#define ZWJ
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by ScriptShape().

◆ ScriptString_pcOutChars()

const int* WINAPI ScriptString_pcOutChars ( SCRIPT_STRING_ANALYSIS  ssa)

Definition at line 3938 of file usp10.c.

3939 {
3940  StringAnalysis *analysis = ssa;
3941 
3942  TRACE("(%p)\n", ssa);
3943 
3944  if (!analysis) return NULL;
3945  return &analysis->clip_len;
3946 }
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
int clip_len
Definition: usp10.c:714

Referenced by EDIT_BuildLineDefs_ML(), and test_ScriptString().

◆ ScriptString_pLogAttr()

const SCRIPT_LOGATTR* WINAPI ScriptString_pLogAttr ( SCRIPT_STRING_ANALYSIS  ssa)

Definition at line 3915 of file usp10.c.

3916 {
3917  StringAnalysis *analysis = ssa;
3918 
3919  TRACE("(%p)\n", ssa);
3920 
3921  if (!analysis) return NULL;
3922  if (!(analysis->ssa_flags & SSA_BREAK)) return NULL;
3923  return analysis->logattrs;
3924 }
smooth NULL
Definition: ftsmooth.c:416
DWORD ssa_flags
Definition: usp10.c:712
#define TRACE(s)
Definition: solgame.cpp:4
#define SSA_BREAK
Definition: usp10.h:39
SCRIPT_LOGATTR * logattrs
Definition: usp10.c:720

◆ ScriptString_pSize()

const SIZE* WINAPI ScriptString_pSize ( SCRIPT_STRING_ANALYSIS  ssa)

Definition at line 3876 of file usp10.c.

3877 {
3878  int i, j;
3879  StringAnalysis *analysis = ssa;
3880 
3881  TRACE("(%p)\n", ssa);
3882 
3883  if (!analysis) return NULL;
3884  if (!(analysis->ssa_flags & SSA_GLYPHS)) return NULL;
3885 
3886  if (!(analysis->flags & SCRIPT_STRING_ANALYSIS_FLAGS_SIZE))
3887  {
3888  analysis->sz.cy = analysis->glyphs[0].sc->tm.tmHeight;
3889 
3890  analysis->sz.cx = 0;
3891  for (i = 0; i < analysis->numItems; i++)
3892  {
3893  if (analysis->glyphs[i].sc->tm.tmHeight > analysis->sz.cy)
3894  analysis->sz.cy = analysis->glyphs[i].sc->tm.tmHeight;
3895  for (j = 0; j < analysis->glyphs[i].numGlyphs; j++)
3896  analysis->sz.cx += analysis->glyphs[i].piAdvance[j];
3897  }
3899  }
3900  return &analysis->sz;
3901 }
int * piAdvance
Definition: usp10.c:696
StringGlyphs * glyphs
Definition: usp10.c:719
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG cx
Definition: windef.h:334
DWORD ssa_flags
Definition: usp10.c:712
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define TRACE(s)
Definition: