GraphRep code for displaying images doesn't support all listed formats
Some elements (e.g. Note) allow to display an image instead of the normal notation. The info texts usually claim that "The following file formats are available: bmp, gif, ico, jpg, jpeg, png, targa, tiff, wbmp, xpm". However, the GraphRep code only supports file extensions with 3 characters (bmp, gif, etc.).
Parts of current GraphRep code:
# Get the graphic (grfk) and the file extension (ext)
SET found:(search(extgfx,"\"",0))
IF (found >= 0) {
IF (found = (LEN extgfx - 1)) {
SET s:(search(extgfx,"@",0) + 1)
SET e:((LEN extgfx) - 1)
} ELSE {
SET s:((found) + 1)
SET foundend:(search(extgfx,"\"",s))
IF (foundend >= 0) {
SET e:((LEN extgfx) - 1)
} ELSE {
SET e:(LEN extgfx)
}
}
} ELSE {
SET e:(LEN extgfx)
SET s:(search(extgfx,"@",0) + 1)
}
SET grfk:(copy (extgfx, s, e - s))
SET s:((LEN grfk) - 4) # This only takes the last 4 characters!
SET e:((LEN grfk))
SET ext:(lower(copy (grfk, s, e)))
# Supported file extensions
SET gfxExtensions:{".bmp", ".gif", ".ico", ".jpg", ".jpeg", ".png", ".targa", ".tiff", ".wbmp", ".xpm"}
# ...
# If there is a valid graphic then show the graphic
IF (ext IN gfxExtensions) {
# ...
}
# ...
Instead the code could be updated to something like (also simplifying; note: uses sIcon instead of extgfx):
# Get the graphic (sGrfk) and the file extension (sExt)
SET sGrfk:(token(sIcon, 1, "@"))
# Remove possible double quotes at start / end
SET iStart:(cond((sGrfk SUB 0) = "\"", 1, 0))
SET iEnd:(cond((sGrfk SUB ((LEN sGrfk) - 1)) = "\"", (LEN sGrfk) - 1, (LEN sGrfk)))
SET sGrfk:(copy(sGrfk, iStart, iEnd - iStart))
# Determine file extension including the dot
SET sExt:(lower(copy(sGrfk, bsearch(sGrfk, ".", -1), -1)))
SET gfxExtensions:{".bmp", ".gif", ".ico", ".jpg", ".jpeg", ".png", ".targa", ".tiff", ".wbmp", ".xpm"}
This issue is in the Note class and possibly other classes as well.