Post by George on May 15, 2020 9:03:16 GMT -5
MUEH has found that the Invalid Character handling is still not working correctly. A while back, rather than having the user specify the valid strings, I put in a routine that queried the current font using the GetGlyphIndices API, if it reported an invalid glyph index, I marked the character as invalid.
However, it seems even with a fixed pitch font, the characters are NOT all the same width.
So I just tried adding addition code so that when a valid glyph is reported, I do a GetCharWidth32 API call to get the width of the individual character, and if it is not the same as a 'normal' character (I use 0-zero as the reference) then I mark it invalid even though it has a glyph.
I thought this would do it.
No, And I have found one particular character X'98' (152) that reports a standard width, but does not display properly.
Question for Robert: Even with the Raster14 font, which I KNOW has all characters defined, X'98' does not work.
Anyone have thoughts on what may be going on. I'm seriously considering going back to using the invalid character list provided on Options => General.
George
For anyone's interest, here's the code that determines character validity.
However, it seems even with a fixed pitch font, the characters are NOT all the same width.
So I just tried adding addition code so that when a valid glyph is reported, I do a GetCharWidth32 API call to get the width of the individual character, and if it is not the same as a 'normal' character (I use 0-zero as the reference) then I mark it invalid even though it has a glyph.
I thought this would do it.
No, And I have found one particular character X'98' (152) that reports a standard width, but does not display properly.
Question for Robert: Even with the Raster14 font, which I KNOW has all characters defined, X'98' does not work.
Anyone have thoughts on what may be going on. I'm seriously considering going back to using the invalid character list provided on Options => General.
George
For anyone's interest, here's the code that determines character validity.
FUNCTION sGetValidChars(lDC AS DWORD) AS STRING
'---------- Get list of valid characters in the current Font
REGISTER i AS LONG
LOCAL AllChars, ValidChars AS STRING, StdWidth AS LONG
DIM GlyphIX(0 TO 255) AS WORD
DIM GetCharAnswer(0 TO 1) AS LONG
IF GetCharWidth32(lDC, 30, 30, GetCharAnswer(0)) THEN ' Try to get width of a 0 (zero)
StdWidth = GetCharAnswer(0) ' Save it as the 'standard'
END IF '
AllChars = CHR$(0 TO 255) ' Make list of all 256 characters
GetGlyphIndices(lDC, BYVAL STRPTR(AllChars), 256, BYVAL VARPTR(GlyphIX(0)), %GGI_MARK_NONEXISTING_GLYPHS)
FOR i = 0 TO 255 ' See which ones are valid
IF GlyphIX(i) <> &HFFFF?? THEN ' We have a glyph
IF GetCharWidth32(lDC, i, i, GetCharAnswer(0)) THEN ' Try to get width
IF GetCharAnswer(0) = StdWidth THEN ' If it matches the standard
ValidChars += CHR$(i) ' Add to the valid chars string
END IF '
END IF '
END IF '
NEXT i '
FUNCTION = ValidChars ' Return the answer
END FUNCTION