Skip to content

Commit

Permalink
Merge branch 'zhaori96-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
oneplus1000 committed Aug 27, 2023
2 parents c7fca9c + 6383add commit d6ac6c0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions gopdf.go
Original file line number Diff line number Diff line change
Expand Up @@ -1690,6 +1690,21 @@ func (gp *GoPdf) MeasureTextWidth(text string) (float64, error) {
return PointsToUnits(gp.config.Unit, textWidthPdfUnit), nil
}

// MeasureCellHeightByText : measure Height of cell by text (use current font)
func (gp *GoPdf) MeasureCellHeightByText(text string) (float64, error) {

text, err := gp.curr.FontISubset.AddChars(text) //AddChars for create CharacterToGlyphIndex
if err != nil {
return 0, err
}

_, cellHeightPdfUnit, _, err := createContent(gp.curr.FontISubset, text, gp.curr.FontSize, gp.curr.CharSpacing, nil)
if err != nil {
return 0, err
}
return PointsToUnits(gp.config.Unit, cellHeightPdfUnit), nil
}

// Curve Draws a Bézier curve (the Bézier curve is tangent to the line between the control points at either end of the curve)
// Parameters:
// - x0, y0: Start point
Expand Down

0 comments on commit d6ac6c0

Please sign in to comment.