Copy link to clipboard
Copied
HI All
What boss class and interface I need to add in fr file to hook into the text composition engine of indesign.
e.g I wants my plugin to catch the each keyboard key pressed and I should render a shape as it is defined in a specific font file,
I will appreciate any help here.
Regards,
Alam
Copy link to clipboard
Copied
I don't understand what you are trying to do. Can you clarify it please?
Copy link to clipboard
Copied
Hi Willi,
As of now when user pressed a character so before it display to user it goes to indesign text composition engine where it check what kind of paragraph composer or other things and do final rendering.
So I want that instead of default rendering of character by InDesign text subsystem my plugin register a custom composer with service registry and use some code to fetch the character shape from a font file and render it.
Hope it clear now
Copy link to clipboard
Copied
For your @Willi Adelberger understanding - it was a bit unfortunate to have the formerly separate InDesign SDK forum, used to discuss C++ plugin development, merged into general U2U forums with that tiny "SDK" tag. On the other hand I appreciate and find it interesting that after a long period of low traffic some newcomers are showing up.
Copy link to clipboard
Copied
You are mixing up multiple concepts.
Your keypress aka user typing records a string of characters into the text of a story. You can interfere with that by using a text preprocess service, along with attributes and styles applied, and other editing. Modify the string, offset in story text, change attributes, cancel the edit.
The composer is chosen via one attribute at paragraph level, so it can change per paragraph. Composition scans the resulting text and attributes, computes a composition style (set of effective values) and feeds the text chunks plus the style into the named composer program to produce "wax" output - resolved font, convert characters to glyph ids by help of the font, transform each glyph by scale and position. Also render associated graphics elements such as the dotted underline, the paragraph rules and so forth.
A custom composer is doable, again as another service. There is even the "singlelinecomposer" SDK example as starting point, that should tell all about boss classes and interfaces. Of course this example does not include the sophisticated algorithms of the real composers that consider multiple lines of a paragraph, so unless you have a few spare multi-person years, I'd not recommend going down that road.
As far as I know the actual composition is not extensible e.g. to post process the wax objects before they are output to the document.
As you mention shapes, also have a look at SDK/external/WRServices . Plenty special typographic details, also referring to harfbuzz, a "text shaping engine". So if you mean that concept of shaping / interpreting a font file, it might be worth to investigate. I don't know how to use it though, and for what purpose the whole folder is included. Is harfbuzz extensible? Maybe file a developer support request.
Copy link to clipboard
Copied
thanks for all replies,
I step down the problem and now looking to implement a mechanism to get the key down event notification (when user presses a key in text frame). Do I need to do it through observer pattern if yes then what protocol and command I need to use Or Let me know some other alternate solution
Copy link to clipboard
Copied
A keypress can type text, move the cursor, select the text frame, invoke a menu action or other shortcut or more.
If this is about editing / typing text, I already mentioned to write a text preprocess service provider. It would also cover changes to the text via scripting, find-change and so forth, or when you're working in overset displayed in a text editor window rather than within a text frame in a layout window.
E.g. following SDK docs for html/classk_x_m_l_text_pre_process_boss.html
Aggregate IID_IK2SERVICEPROVIDER kTextPreProcessService, and your implementation of ITextCommandPreProcess. There is also a post process service.
If this is really about raw events, there are plenty interfaces that start with IEvent, also touched by SDK examples and the programming guide. More appropriate for own widgets. Don't forget about IKeyBoard because even with a text selection the focus might be in a panel. You may also have to deal with ITextFocus and alike working your way to the selection subsystem. Somewhere in related headers I've also seen notices that event handlers etc. are going out of fashion, typical use cases are expected to get covered at a level not exposed for third parties.