locked
[MS-EMF] Query on EMF EmrText structure (OutputDx) RRS feed

  • Question

  • G'day,

    MS-EMF Section 2.2.4 describes the EmrText structure. See
    http://msdn.microsoft.com/en-us/library/cc204228.aspx

    It says:

    OutputDx (variable): An array of 32-bit integers that specify the spacing between characters, in logical units. Its location, in bytes offset from the start of the record in which this object is contained, is specified by the offDx field, and its length is specified by the Chars field.

    I understand this array being a spacing array, but not how it is intended to be used. In particular, I don't understand whether it is meant to be a spacing of 0 for standard spacing (based on font metrics and any hinting), or whether it is meant to be the offset relative to the previous char baseline position. Perhaps a diagram might be the best way to describe it.


    Questions:
    1. How does the spacing array vary the intended character spacing? What is the spacing value relative to?

    2. How is the spacing array intended to be used in RTL strings?

    Brad

    Saturday, October 4, 2008 4:19 AM

Answers

  •  

    Hi Brad,

     

    We’ve concluded our investigation and the text will be modified to help clarify the section.

     

    In the following paragraph :

     

    “An array of 32-bit unsigned integers that specify the output spacing between characters in logical units. The location of this field is specified by the value of offDx in bytes from the start of this record. If spacing is defined, this field contains the same number of values as characters in the output string.”

     

     

    The expression  "between characters", will be replaced by something in the lines of "between the origins of adjacent character cells".

     

    This is based on the fact that the Dx array maps directly to the eighth argument of the ExtTextOut API, described in http://msdn.microsoft.com/en-us/library/ms533949.aspx . Note that this is documented as "Pointer to an optional array of values that indicate the distance between origins of adjacent character cells. For example, lpDx[i] logical units separate the origins of character cell i and character cell i + 1." That is, the values are from cell to cell (not from the origin of the whole string), and if this array is provided then the normal width of each character is ignored, that is, this allows for a complete custom positioning of every character.

     

    Please let me know if this clarifies your questions.

     

    Thanks and regards,


    SEBASTIAN CANEVARI - MSFT SEE Protocol Documentation Team
    • Marked as answer by Brad Hards Friday, October 17, 2008 11:25 PM
    Friday, October 17, 2008 6:14 PM

All replies

  •  Hi Brad, thanks for your post regarding the [MS-EMF] protocol specification. We will review your question and update the forum once our investigation is complete.

    Thanks!
    John Dunning
    Escalation Engineer Microsoft Corporation
    US-CSS DSC PROTOCOL TEAM

    Saturday, October 4, 2008 1:35 PM
  •  

    Hi Brad,

     

    The section has been modified and has more detailed + expanded info.

     

    Please let me know if this covers your need.

     

    Please let me know if it does not.

     

    Thanks!

     

    Sebastian

     

     (copied in next post) 


    SEBASTIAN CANEVARI - MSFT SEE Protocol Documentation Team
    Saturday, October 11, 2008 2:43 AM
  •  

    2.2.5    EmrText Object

    1                   The EmrText object contains values for text output.

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    1
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    2
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    3
    0

    1

    Reference

    ...

    Chars

    offString

    Options

    Rectangle

    ...

    ...

    ...

    offDx

    StringBuffer (variable)

    ...

    DxBuffer (variable)

    ...

    Reference (8 bytes):  A WMF PointL object ([MS-WMF] section 2.2.1.12) that specifies the coordinates of the reference point used to position the string.

    Chars (4 bytes):  A 32-bit unsigned integer that specifies the number of characters in the string.

    offString (4 bytes):  A 32-bit unsigned integer that specifies the offset to the output string, in bytes, from the start of the record in which this object is contained. This value MUST be 8 or 16-bit aligned, according to the character format.

    Options (4 bytes):  A 32-bit unsigned integer that specifies how to use the rectangle values specified in the Rectangle field. This field can be a combination of more than one ExtTextOutOptions enumeration (section 2.1.11) values.

    Rectangle (16 bytes):  An optional WMF RectL object ([MS-WMF] section 2.2.1.15) that defines a clipping and/or opaquing rectangle in logical units.

    offDx (4 bytes):  A 32-bit unsigned integer that specifies the offset to an intercharacter spacing array, in bytes, from the start of the record in which this object is contained. This value MUST be 32-bit aligned.

    StringBuffer (variable):  The character string buffer.

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    1
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    2
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    3
    0

    1

    UndefinedSpace1 (variable)

    ...

    OutputString (variable)

    ...

    UndefinedSpace1 (variable):  An optional number of unused bytes. The OutputString field is not required to follow immediately the preceding portion of this structure.

    OutputString (variable):  An array of characters that specify the string to output. The location of this field is specified by the value of offString in bytes from the start of this record. The number of characters is specified by the value of Chars.

    DxBuffer (variable):  The optional character spacing buffer.

    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    1
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    2
    0

    1

    2

    3

    4

    5

    6

    7

    8

    9

    3
    0

    1

    UndefinedSpace2 (variable)

    ...

    OutputDx (variable)

    ...

    UndefinedSpace2 (variable):  An optional number of unused bytes. The OutputDx field is not required to follow immediately the preceding portion of this structure.

    OutputDx (variable):  An array of 32-bit unsigned integers that specify the output spacing between characters in logical units. The location of this field is specified by the value of offDx in bytes from the start of this record. If spacing is defined, this field contains the same number of values as characters in the output string.

    2                   The size and encoding of the characters in the OutputString is determined by the type of record that contains the EmrText object, as follows:

    §  EMR_EXTTEXTOUTA (section 2.3.5.7) and EMR_POLYTEXTOUTA (section 2.3.5.32) records: 8-bit ASCII characters.

    §  EMR_EXTTEXTOUTW and EMR_POLYTEXTOUTW records: 16-bit UnicodeUTF16-LE characters.

     

     


    SEBASTIAN CANEVARI - MSFT SEE Protocol Documentation Team
    Saturday, October 11, 2008 2:51 AM
  • Sebastian,

    That does help a bit, but doesn't fully answer my query / concern.

    I'll try again. Lets say I have a text string ("AB"). If the horizontal width of "A" is Xa, and the original width of "B" is Xb, then the spacing array (if present) will contain two 32-bit unsigned integers (say Dx[0], Dx[1]). Is the reference position of "B" supposed to be offset from the reference position of "A" in the x-axis by (Xa+Dx[0])? Is the final reference position (if it is to be updated) offset from the original text position (in the x-axis) by Xa+Dx[0]+Xb+Dx[1]?

    What happens if the text is vertical? Is the offset then in the vertical direction and relative to the vertical height of "A" and "B"?

    Brad


    Saturday, October 11, 2008 3:28 AM
  •  

    Hi Brad,

     

    We’ve concluded our investigation and the text will be modified to help clarify the section.

     

    In the following paragraph :

     

    “An array of 32-bit unsigned integers that specify the output spacing between characters in logical units. The location of this field is specified by the value of offDx in bytes from the start of this record. If spacing is defined, this field contains the same number of values as characters in the output string.”

     

     

    The expression  "between characters", will be replaced by something in the lines of "between the origins of adjacent character cells".

     

    This is based on the fact that the Dx array maps directly to the eighth argument of the ExtTextOut API, described in http://msdn.microsoft.com/en-us/library/ms533949.aspx . Note that this is documented as "Pointer to an optional array of values that indicate the distance between origins of adjacent character cells. For example, lpDx[i] logical units separate the origins of character cell i and character cell i + 1." That is, the values are from cell to cell (not from the origin of the whole string), and if this array is provided then the normal width of each character is ignored, that is, this allows for a complete custom positioning of every character.

     

    Please let me know if this clarifies your questions.

     

    Thanks and regards,


    SEBASTIAN CANEVARI - MSFT SEE Protocol Documentation Team
    • Marked as answer by Brad Hards Friday, October 17, 2008 11:25 PM
    Friday, October 17, 2008 6:14 PM
  • Sebastian,

    Looks like it fully answers my question. This one is a bit complex, so I'll have to take another look. In the mean time, consider it answered, and I'll raise another issue (or unmark if I don't miss the window) if anything else comes up.

    Thanks for the investigation work.

    Brad
    Friday, October 17, 2008 11:25 PM