Skip to content

Commit

Permalink
#4088 - System print out subscripted text imperfectly (#4153)
Browse files Browse the repository at this point in the history
- fixed the order of applying text styles

Co-authored-by: Roman Rodionov <roman_rodionov@epam.com>
  • Loading branch information
rrodionov91 and rrodionov91 authored Feb 27, 2024
1 parent 9e7af50 commit 7f0d927
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 0 additions & 4 deletions packages/ketcher-core/src/application/render/renderStruct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@ export class RenderStruct {
return;
}

console.log('-----START-------');
console.log(struct.sgroups);
const preparedStruct = this.prepareStruct(struct);
console.log(preparedStruct.sgroups);
console.log('-----END-------');
preparedStruct.initHalfBonds();
preparedStruct.initNeighbors();
preparedStruct.setImplicitHydrogen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@ class ReText extends ReObject {
null,
);

// Sort to apply font size styles first and then override it by subscript/superscript styles
ranges.sort((_, nextRange) => {
return nextRange.style.includes(TextCommand.FontSize) ? 1 : -1;
});

return ranges.reduce(
(styles: any, textRange: CustomRawDraftInlineStyleRange) => {
const fontsz = customFontSize || options.fontsz;
Expand Down

0 comments on commit 7f0d927

Please sign in to comment.