This seems suspicious to me. Why can't we use those values in glyphmetrics if GetGlyphOutlineW returns 0? Does Windows provide bad values in this case, or is our GetGlyphOutlineW broken? When does the call to GetGlyphOutlineW in the second loop fail, and why ignore those failures?