comparison dwt/graphics/TextLayout.d @ 288:af37dd280317

Fix: set SCRIPT_CACHE to zero
author Frank Benoit <benoit@tionex.de>
date Thu, 21 Aug 2008 16:08:55 +0200
parents 35d730fb5e9f
children 1973f21c5c6f
comparison
equal deleted inserted replaced
287:35d730fb5e9f 288:af37dd280317
2897 } 2897 }
2898 2898
2899 bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) { 2899 bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) {
2900 bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex; 2900 bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex;
2901 if (useCMAPcheck) { 2901 if (useCMAPcheck) {
2902 ushort[] glyphs = new ushort[wchars.length]; 2902 scope ushort[] glyphs = new ushort[wchars.length];
2903 if (OS.ScriptGetCMap(hdc, run.psc, wchars.ptr, wchars.length, 0, glyphs.ptr) !is OS.S_OK) { 2903 if (OS.ScriptGetCMap(hdc, run.psc, wchars.ptr, wchars.length, 0, glyphs.ptr) !is OS.S_OK) {
2904 if (run.psc !is null) { 2904 if (run.psc !is null) {
2905 OS.ScriptFreeCache(run.psc); 2905 OS.ScriptFreeCache(run.psc);
2906 glyphCount[0] = 0; 2906 glyphCount[0] = 0;
2907 int[1] one = 1; 2907 int[1] one = 1;
2908 // OS.MoveMemory( run.psc, one.ptr, (void*).sizeof ); 2908 *cast(int*)run.psc = 0;
2909 // DWT: FIXME This should be checked, it works in Java with the MoveMemory
2910 } 2909 }
2911 return false; 2910 return false;
2912 } 2911 }
2913 //delete glyphs;
2914 } 2912 }
2915 auto hr = OS.ScriptShape(hdc, run.psc, wchars.ptr, wchars.length, maxGlyphs, &run.analysis, run.glyphs, run.clusters, run.visAttrs, glyphCount.ptr); 2913 auto hr = OS.ScriptShape(hdc, run.psc, wchars.ptr, wchars.length, maxGlyphs, &run.analysis, run.glyphs, run.clusters, run.visAttrs, glyphCount.ptr);
2916 run.glyphCount = glyphCount[0]; 2914 run.glyphCount = glyphCount[0];
2917 if (useCMAPcheck) return true; 2915 if (useCMAPcheck) return true;
2918 2916
2929 if (i is glyphs.length) return true; 2927 if (i is glyphs.length) return true;
2930 } 2928 }
2931 if (run.psc !is null) { 2929 if (run.psc !is null) {
2932 OS.ScriptFreeCache(run.psc); 2930 OS.ScriptFreeCache(run.psc);
2933 glyphCount[0] = 0; 2931 glyphCount[0] = 0;
2934 int[1] one = 1; 2932 *cast(int*)run.psc = 0;
2935 OS.MoveMemory( run.psc, one.ptr, (void*).sizeof );
2936 } 2933 }
2937 run.glyphCount = 0; 2934 run.glyphCount = 0;
2938 return false; 2935 return false;
2939 } 2936 }
2940 2937