SCRIPT_DIGITSUBSTITUTE psds = new SCRIPT_DIGITSUBSTITUTE(); OS.ScriptRecordDigitSubstitution(OS.LOCALE_USER_DEFAULT, psds); OS.ScriptApplyDigitSubstitution(psds, scriptControl, scriptState);
StyleItem[] itemize () {	segmentsText = getSegmentsText();	int length = segmentsText.length();	SCRIPT_CONTROL scriptControl = new SCRIPT_CONTROL();	SCRIPT_STATE scriptState = new SCRIPT_STATE();	final int MAX_ITEM = length + 1;		if ((orientation & SWT.RIGHT_TO_LEFT) != 0) {		scriptState.uBidiLevel = 1;		scriptState.fArabicNumContext = true;	}		int hHeap = OS.GetProcessHeap();	int pItems = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, MAX_ITEM * SCRIPT_ITEM.sizeof);	int[] pcItems = new int[1];		char[] chars = new char[length];	segmentsText.getChars(0, length, chars, 0); 	OS.ScriptItemize(chars, length, MAX_ITEM, scriptControl, scriptState, pItems, pcItems);//	if (hr == E_OUTOFMEMORY) //TODO handle it		StyleItem[] runs = merge(pItems, pcItems[0]);	OS.HeapFree(hHeap, 0, pItems);	return runs;}