Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Understanding code in TextLayout Win32

Hi

In the Win32 SWT in graphics.TextLayout, starting at line 2730 there is this code:

bool shape (int /*long*/ hdc, StyleItem run, char[] chars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES sp) {
    bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex;
    if (useCMAPcheck) {
        short[] glyphs = new short[chars.length];
        if (OS.ScriptGetCMap(hdc, run.psc, chars, chars.length, 0, glyphs) !is OS.S_OK) {
            if (run.psc !is 0) {
                OS.ScriptFreeCache(run.psc);
                glyphCount[0] = 0;
                OS.MoveMemory(run.psc, new int /*long*/ [1], OS.PTR_SIZEOF);

I try to understand the last line MoveMemory.
run.psc is a SCRIPT_CACHE, which is a opaque type.
Why is it overwritten with '1' ?
Can someone please help me to understand this. I am working on a D port of this code. Without this lines it seems to work, with this line it crashes. The original Java SWT code does work properly with the same testcase.

Frank

Back to the top