How to use IGraphicsPort to draw text with CMYK colors in an IDialog?
Copy link to clipboard
Copied
I need to override virtual void IControlView::Draw(IViewPort* viewPort, SysRgn updateRgn = nil); for StaticTextLabel. In this function, I need to use IGraphicsPort to draw some text with a CMYK color. However, after setting the CMYK color, the displayed color is incorrect. I suspect that it is not using the CMYK color space but instead the RGB color space.
How can I draw text using CMYK colors in a StaticTextLabel inside an IDialog? Can anyone help me?
Copy link to clipboard
Copied
No idea to be honest - maybe @Dirk Becker or @m1b ----system won't let me tag people easily, sigh.
Let me ramble for a moment and see if it tingles any spidey senses for you.
Indesign will work in RGB space, even if your swatches are CMYK, the dialog itself is RGB... right?
So setting the CMYK colour directly means that the system might be converting it to RGB or simply not recognise cmyk?
Maybe it's something like your CMYK values and convert them to the corresponding RGB values using InDesign’s colour management.
Use APIs like the ColorSetting interface (check out the ColorSetting DOM API ) to query the current colour settings and then apply the appropriate conversion. Maybe you can get RGB value that mimics your intended CMYK output.
Thinking out side the box, on a topic I'm not comfortable with at all, but maybe another approach is to define a CMYK swatch within your document.
Once you define your CMYK values, can then maybe get InDesign’s API methods (such as SetTextInkColor (if I have that right???)) to assign that swatch to your text. It could mean that InDesign’s internal colour management deals with the conversion.
I guess what I'm wondering is if your your document’s CMYK working space is set correctly and that you’re aware of how InDesign’s colour management might be influencing the appearance of your drawn text.
You might also consider testing with Overprint Preview. Sometimes toggling Overprint Preview or viewing a PDF export can help confirm if your conversion or swatch approach is working as intended.
I'm thinking by either converting your CMYK values manually or leveraging a CMYK swatch with InDesign’s built-in methods, you might be able to achieve the correct appearance for your text in the dialog.
But I'm out of my depth - and been looking at this post for a while and this is the best I can come up with.
Copy link to clipboard
Copied
HI @Eugene Tyson, Dirk will be the expert here. I don't know anything about the SDK.
- Mark
Copy link to clipboard
Copied
There is no problem with rendering CMYK colors in the document. My current issue is with displaying CMYK colors in a dialog box.
For example, in InDesign's built-in Color Panel, CMYK colors are displayed correctly. CMYK color display should not be inherently tied to an open document. Even when no document is open, InDesign's Color Panel can still display CMYK colors properly.
My problem is that when I create my own dialog box and render CMYK colors on it, the same CMYK values appear differently on the screen compared to InDesign's built-in Color Panel.

