Skip to content

Commit

Permalink
fix(drawer): set font attribute in wrapText #WIK-17044 (#233)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubuzhixing8 authored Jan 21, 2025
1 parent 57d3212 commit a75d0bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/grid/src/renderer/drawers/drawer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,11 @@ export class Drawer {
} = options;
let offsetX = 0;
let offsetY = 0;
const fontStyle = `${fontWeight} ${fontSize}px ${DEFAULT_FONT_FAMILY}`;
const baselineOffset = verticalAlign === DEFAULT_TEXT_VERTICAL_ALIGN_TOP ? fontSize / 2 : 0;
const fontStyle = `${fontWeight}-${fontSize}px`;
const fontStyleKey = `${fontWeight}-${fontSize}px`;
const isUnderline = textDecoration === 'underline';
this.ctx.font = fontStyle;
const textRenderer = (textDataList: any[]) => {
textDataList.forEach((data) => {
const { offsetX, offsetY, text, width, linkUrl } = data;
Expand All @@ -278,8 +280,7 @@ export class Drawer {

if (fillStyle) this.setStyle({ fillStyle });
this.ctx.textAlign = textAlign;

const cacheKey = `${fontStyle}-${maxRow}-${maxWidth || 0}-${fieldType}-${text}`;
const cacheKey = `${fontStyleKey}-${maxRow}-${maxWidth || 0}-${fieldType}-${text}`;
const cacheTextData = textDataCache.get(cacheKey);
if (cacheTextData) {
if (this.needDraw && needDraw) {
Expand Down

0 comments on commit a75d0bc

Please sign in to comment.