Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(render-engine): punctuation render error in sheet cell (#2034)
Ran Luod7ddad11c3d8
diff --git a/packages/engine-render/src/basics/draw.ts b/packages/engine-render/src/basics/draw.tsindex da71a96cf4..267e167856 100644--- a/packages/engine-render/src/basics/draw.ts+++ b/packages/engine-render/src/basics/draw.ts@@ -252,6 +252,7 @@ export function getRotateOrientation(angle: number) {}// rotate calculate logic https://www.processon.com/view/link/630df928f346fb0714c9c4ec+// eslint-disable-next-line max-lines-per-functionexport function getRotateOffsetAndFarthestHypotenuse(lines: IDocumentSkeletonLine[],rectWidth: number,diff --git a/packages/engine-render/src/components/docs/document.ts b/packages/engine-render/src/components/docs/document.tsindex 71d9e17568..dcf1f274af 100644--- a/packages/engine-render/src/components/docs/document.ts+++ b/packages/engine-render/src/components/docs/document.ts@@ -461,6 +461,7 @@ export class Documents extends DocComponent {alignOffset);+const extensionOffset: IExtensionConfig = {originTranslate,spanStartPoint,diff --git a/packages/engine-render/src/components/docs/layout/tools.ts b/packages/engine-render/src/components/docs/layout/tools.tsindex 6272fb42fd..2123916b61 100644--- a/packages/engine-render/src/components/docs/layout/tools.ts+++ b/packages/engine-render/src/components/docs/layout/tools.ts@@ -345,11 +345,18 @@ export function updateBlockIndex(pages: IDocumentSkeletonPage[], start: number =maxLineAsc = Math.max(maxLineAsc, ba);if (i === divideLength - 1) {- // When the width is set to Infinity, the last divide should also be Infinity, and an actual width needs to be calculated.actualWidth += glyph.width;}}+ // When the width is set to Infinity, the last divide should also be Infinity, and an actual width needs to be calculated.+ // Use to fix issue: https://github.com/dream-num/univer/issues/2002+ // Because the Chinese punctuation marks at the beginning and end of the line are squeezed and narrowed,+ // the extruded width needs to be added when calculating the overall width.+ if (glyphGroup[0].xOffset !== 0 && i === divideLength - 1) {+ actualWidth -= glyphGroup[0].xOffset;+ }+if (i === divideLength - 1) {// if (divide.width === Infinity) {// divide.width = actualWidth;@@ -477,7 +484,7 @@ export function columnIterator(}}-// eslint-disable-next-line max-lines-per-function+export function getPositionHorizon(positionH: ObjectPositionH,column: IDocumentSkeletonColumn,@@ -572,7 +579,7 @@ export function getPositionHorizon(}}-// eslint-disable-next-line complexity+export function getPositionVertical(positionV: ObjectPositionV,page: IDocumentSkeletonPage,diff --git a/packages/engine-render/src/components/sheets/extensions/font.ts b/packages/engine-render/src/components/sheets/extensions/font.tsindex b71113bd15..2cc28bcf4c 100644--- a/packages/engine-render/src/components/sheets/extensions/font.ts+++ b/packages/engine-render/src/components/sheets/extensions/font.ts@@ -270,6 +270,7 @@ export class Font extends SheetExtension {const overflowRectangle = overflowCache.getValue(row, column);if (!(wrapStrategy === WrapStrategy.WRAP && !overflowRectangle && vertexAngle === 0)) {const contentSize = getDocsSkeletonPageSize(documentSkeleton);+const documentStyle = documentSkeleton.getViewModel().getDataModel().getSnapshot().documentStyle;if (contentSize && documentStyle) {const { width } = contentSize;