Resize MacOS icons and script their creation

Creates a script that will fomat the MacOS icons at 80% of the total
size in line with Apple's guidelines.

Script requires Inkscape 1.0 and png2icns (available on Linux boxen)

Fixes https://gitlab.com/kicad/code/kicad/issues/7977
This commit is contained in:
Seth Hillbrand 2021-07-30 20:22:32 -07:00
parent ad8acd328c
commit e7d8b1a975
16 changed files with 69 additions and 5 deletions

64
bitmaps_png/mk_mac_icons.sh Executable file
View File

@ -0,0 +1,64 @@
#!/bin/bash
#
# make macos icons using Inkscape
mkdir macos_tmp
# convert .svg files into .png files
SIZES="16x16
32x32
128x128
256x256
512x512
1024x1024"
ICONS="bitmap2component
eeschema
gerbview
kicad
pagelayout_editor
pcbcalculator
pcbnew"
for pgm in $ICONS
do
output=""
for size in $SIZES
do
sz=${size%x*}
echo -e '\E[0;32m'"\nMaking the applications icons with size $size."
# MacOS wants icons with 10% clearance on each side
let "sub_sz = $sz * 8 / 10"
# Use specialized icons for smaller sizes to keep pixel alignment
if [ $sz -le 32 ]
then
inkscape sources/light/icon_${pgm}_${sz}.svg -o macos_tmp/${pgm}_small_${sz}px.png -w ${sub_sz} -h ${sub_sz} --export-area-snap
else
inkscape sources/light/icon_${pgm}.svg -o macos_tmp/${pgm}_small_${sz}px.png -w ${sub_sz} -h ${sub_sz} --export-area-snap
fi
convert macos_tmp/${pgm}_small_${sz}px.png -size $size xc:transparent +swap -gravity center -composite macos_tmp/${pgm}_${sz}px.png
output+="macos_tmp/${pgm}_${sz}px.png "
done
if [ ${pgm} == "pcbcalculator" ]
then
# mismatch in the pcbcalculator icon names
png2icns ../pcb_calculator/pcb_calculator.icns ${output}
elif [ ${pgm} == "bitmap2component" ]
then
#bitmap2component does not have associated documents
png2icns ../${pgm}/${pgm}.icns ${output}
else
png2icns ../${pgm}/${pgm}.icns ${output}
cp ../${pgm}/${pgm}.icns ../${pgm}/${pgm}_doc.icns
fi
done
rm -rf macos_tmp

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -62,15 +62,15 @@ endif()
if( APPLE )
# setup bundle
set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES
set( PL_EDITOR_RESOURCES pagelayout_editor.icns pagelayout_editor_doc.icns )
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pagelayout_editor.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES
set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pagelayout_editor_doc.icns" PROPERTIES
MACOSX_PACKAGE_LOCATION Resources
)
set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-pcb.kicad )
set( MACOSX_BUNDLE_ICON_FILE pagelayout_editor.icns )
set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad.kicad )
set( MACOSX_BUNDLE_NAME pl_editor )
endif()

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.