Skip to main content
Inspiring
March 3, 2025
Question

How to use IGraphicsPort to draw text with CMYK colors in an IDialog?

  • March 3, 2025
  • 1 reply
  • 215 views

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?

1 reply

Community Expert
March 8, 2025

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. 

 

 

 

m1b
Community Expert
Community Expert
March 8, 2025

HI @Eugene Tyson, Dirk will be the expert here. I don't know anything about the SDK.

- Mark