desktopToDarwinBundle: fix 16x, 32x app icons
Changes the script to produce rgb+mask images for 16x and 32x icons instead of png. Using icns files containing 16x and 32x png images for app bundles results in Finder misrendering icons for these sizes (even though the icns files are rendered correctly when viewed by themselves)
This commit is contained in:
parent
059ac8281d
commit
3b52cd4c1b
@ -92,6 +92,7 @@ convertIconTheme() {
|
||||
|
||||
echo "desktopToDarwinBundle: resizing icon $in to $out, size $dim" >&2
|
||||
magick convert -scale "${dim}x${dim}" -density "$density" -units PixelsPerInch "$in" "$out"
|
||||
convertIfUnsupportedIcon "$out" "$iconSize" "$scale"
|
||||
}
|
||||
|
||||
function synthesizeIcon() {
|
||||
@ -107,11 +108,27 @@ convertIconTheme() {
|
||||
echo "desktopToDarwinBundle: rasterizing svg $in to $out, size $dim" >&2
|
||||
rsvg-convert --keep-aspect-ratio --width "$dim" --height "$dim" "$in" --output "$out"
|
||||
magick convert -density "$density" -units PixelsPerInch "$out" "$out"
|
||||
convertIfUnsupportedIcon "$out" "$iconSize" "$scale"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# macOS does not correctly display 16x and 32x png icons on app bundles
|
||||
# they need to be converted to rgb+mask (argb is supported only from macOS 11)
|
||||
function convertIfUnsupportedIcon() {
|
||||
local -r in=$1
|
||||
local -r iconSize=$2
|
||||
local -r scale=$3
|
||||
local -r out=${in%.png}.rgb
|
||||
|
||||
if [[ ($scale -eq 1) && ($iconSize -eq 32 || $iconSize -eq 16) ]]; then
|
||||
echo "desktopToDarwinBundle: converting ${iconSize}x icon to rgb" >&2
|
||||
icnsutil convert "$out" "$in"
|
||||
rm "$in"
|
||||
fi
|
||||
}
|
||||
|
||||
function getIcons() {
|
||||
local -r sharePath=$1
|
||||
local -r iconname=$2
|
||||
@ -151,6 +168,7 @@ convertIconTheme() {
|
||||
fixed)
|
||||
local density=$((72 * scale))x$((72 * scale))
|
||||
magick convert -density "$density" -units PixelsPerInch "$icon" "$result"
|
||||
convertIfUnsupportedIcon "$result" "$iconSize" "$scale"
|
||||
foundIcon=OTHER
|
||||
;;
|
||||
threshold)
|
||||
|
Loading…
Reference in New Issue
Block a user