Paste: change to windows.uniscribe to expand tabs

Author: hsuh
Mode: factor
Date: Wed, 9 Dec 2009 22:02:09
Plain Text |
: <pTabDef> ( -- struct )
    SCRIPT_TABDEF <struct>
    1 >>cTabStops
    4 <int> malloc-byte-array &free >>pTabStops ;

: make-script-string ( dc string -- script-string )
    dup selection? [ string>> ] when
    [ utf16n encode ] ! pString
    [ length ] bi ! cString
    dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended size"
    -1 ! iCharset -- Unicode
    SSA_GLYPHS SSA_TAB bitor ! dwFlags
    0 ! iReqWidth
    f ! psControl
    f ! psState
    f ! piDx
    <pTabDef> ! pTabdef
    f ! pbInClass
    f <void*> ! pssa
    [ 
        [ ScriptStringAnalyse ] keep
        [ ole32-error ] [ |ScriptStringFree *void* ] bi* 
    ] with-destructors ;

Annotation: this crashes

Author: hsuh
Mode: factor
Date: Wed, 9 Dec 2009 22:15:16
Plain Text |
: <pTabDef> ( -- struct )
    [
        SCRIPT_TABDEF <struct>
        1 >>cTabStops
        4 <int> malloc-byte-array &free >>pTabStops 
    ] with-destructors ;

: make-script-string ( dc string -- script-string )
    dup selection? [ string>> ] when
    [ utf16n encode ] ! pString
    [ length ] bi ! cString
    dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended size"
    -1 ! iCharset -- Unicode
    SSA_GLYPHS SSA_TAB bitor ! dwFlags
    0 ! iReqWidth
    f ! psControl
    f ! psState
    f ! piDx
    <pTabDef> ! pTabdef
    f ! pbInClass
    f <void*> ! pssa
    [ ScriptStringAnalyse ] keep
    [ ole32-error ] [ |ScriptStringFree *void* ] bi* ;

Annotation: this correct?

Author: hsuh
Mode: factor
Date: Wed, 9 Dec 2009 22:19:36
Plain Text |
: <pTabDef> ( -- struct )
    SCRIPT_TABDEF <struct>
    1 >>cTabStops
    4 <int> malloc-byte-array &free >>pTabStops ; 

: make-script-string ( dc string -- script-string )
    [
        dup selection? [ string>> ] when
        [ utf16n encode ] ! pString
        [ length ] bi ! cString
        dup 1.5 * 16 + >integer ! cGlyphs -- MSDN says this is "recommended size"
        -1 ! iCharset -- Unicode
        SSA_GLYPHS SSA_TAB bitor ! dwFlags
        0 ! iReqWidth
        f ! psControl
        f ! psState
        f ! piDx
        <pTabDef> ! pTabdef
        f ! pbInClass
        f <void*> ! pssa
        [ ScriptStringAnalyse ] keep
        [ ole32-error ] [ |ScriptStringFree *void* ] bi* 
    ] with-destructors ;

New Annotation

Summary:
Author:
Mode:
Body: