Archive: Installer Banner Being Stretched


Installer Banner Being Stretched
Hi.

When we run our NSIS installer that uses MUI under Japanese and Korean systems the custom installer banner is being stretched. It is okay under English systems.

Does anybody know the cause of this and how we can fix it?

NOTE. We are using the Unicode version of NSIS so not sure if the problem is related to this version or is a generic NSIS issue.


Thanks.
Kev.


The different font for CJK will probably cause the dialog units to change. I believe there is a MUI define you can set to disable the stretching...


Hi.

Thanks for your reply.

There is the "MUI_WELCOMEFINISHPAGE_BITMAP_NOSTRETCH" option but according to the documentation we should not use it if the images are the correct size (which we don't because they are).

"Do not stretch the bitmap for the Welcome and Finish page to fit the size of the field. Use this option only if you have an image that does not use the whole space. If you have a full size bitmap that fits exactly, you should not use this option because the size of the field will be different if the user has a custom DPI setting."


I'll give this a go but I guess either the documentation is wrong or there is a bug somewhere.


Mui_headerimage_bitmap_nostretch?


Using the nostretch options does solve the stretching problem. However, it has introduced the following issues:
1. The welcome banner is now cropped even though the image is the correct size (we are missing quite a few pixels from the bottom).

2. The header now has a grey bar at the bottom that runs from the end of the header image to the end of the dialog.


I would attach some screen shot but every picture I try to attach is deemed as invalid even though they are the correct format (PNG / JPEG) and below the maximum file size.


Kev.


PNG and JPEG are not supported! Use Windows bitmpa (.bmp) only.


I've just tried a bmp image and that also has failed.

The exact message is "This is not a valid image file.".

Not sure if this is related to my browser but I am using Firefox 23.01 under Mac OS X 10.8


Kev.


I don't think there's need for screenshots anyway. You're getting an expected result and you even quoted the explanation yourself. Page elements are scaled with regard to dpi. The image is resized to fit the size of the field. If you disable stretching, the proportion to the rest of the page will not be maintained; the image will fill just a part of the field or be croppped if it's larger. That's why you shouldn't disable stretching.
I'm guessing the cause of your initial problem is that with CJK fonts, which obviously have different dpi, the width and height of the header image are not scaled with the same factor and the aspect ratio gets distorted. If so, the only fix that springs to mind is to use a different image on those systems.


Hi.

I wish I could upload the screen shots as this seems like madness.

In summary...

1. If we allow the banners and headers to stretch then on CJK systems the height of images appears to be correct and only the width is stretched by some strange amount! Our images are the recommended sizes so I don't understand why any resizing should be occurring.

2. If we do not allow the banners and headers to stretch then on CJK systems their proportions are correct but the banner is cropped at the bottom and a visual glitch appears to the right of the header all the way to the end of the dialog.


Using different images for each language would be an unbelievably bad solution. For starters, we do not even know the dimensions that are required for each language and would the dimensions be the same for all operating systems?

This is definitely one area of NSIS that could (should) be improved as it really limits it's use.



Kev.


I believe 1. & 2. are clear and I don't know how to explain it any better than I already have.
My suggestion doesn't require you to use a separate image for each language, just one extra for CJK. It shouldn't be difficult to determine the appropriate dimensions. Then you can use something like this:

!define MUI_CUSTOMFUNCTION_GUIINIT ChkCJK
Function ChkCJK
StrCmp $LANGUAGE ${LANG_JAPANESE} +2
StrCmp $LANGUAGE ${LANG_KOREAN} 0 +3
File /oname=$PLUGINSDIR\modern-header.bmp Header_CJK.bmp
SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\modern-header.bmp"
FunctionEnd

I guess that is better than all languages but what is the recommended dimensions?


Those that fit the control. Use e.g. WinExplorer to examine Static controls on the page. The size of the header image control should normally be 150x57 (which is also the officially recommended bitmap size); check its dimensions with CJK.


ok.

This whole approach seems badly designed. There should be no reason why the images are scaled according to the font DPI.

Is there any way to log enhancement requests?


You can disable the scaling, and you did, and you witnessed the effect, and you wanted to post screenshots of it...


mmm.... we appear to be going around in circles here.

My point is that NSIS should be displaying the images correctly when scaling is switched off. I do not see any reason why the bottom of the side banner should be clipped by a few pixels and for the header (not header image) to appear with a visual glitch.

If it is 'by-design' then ok but the design of this needs improving (correcting) which is why I wanted to know if there was anywhere to log enhancements.


there's the bug tracker on sourceforge for the project.


Thanks,

I've logged this as an enhancement (with screen shots showing the problem) as:

https://sourceforge.net/p/nsis/feature-requests/521/


!include MUI2.nsh
!define MUI_PAGE_CUSTOMFUNCTION_SHOW SizeWelcomeFinish
!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE Korean

Function SizeWelcomeFinish
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 0x4B0
System::Call *(i,i,i,i)i.r0
System::Call 'USER32::GetClientRect(i$R0,ir0)'
System::Call *$0(i,i,i.r1,i.r2)
System::Free $0
StrCpy $R2 $2
${DoWhile} $1 > 164
IntOp $1 $1 - 1
IntOp $2 $2 - 1
${Loop}
${DoWhile} $2 < $R2
IntOp $2 $2 + 1
${Loop}
System::Call 'USER32::SetWindowPos(i$R0,i0,i,i,i$1,i$2,i0x16)'
FunctionEnd
Does some stretching but should look better...