WebCAD-Lib-TS API 文档 - v1.0.0
    Preparing search index...

    Function getFonts

    • Extracts all unique font names used in an MText string. This function searches for font commands in the format \f{fontname}| or \f{fontname}; and returns a set of unique font names. Font names are converted to lowercase to ensure case-insensitive uniqueness.

      Parameters

      • mtext: string

        The MText string to analyze for font names

      • removeExtension: boolean = false

        Whether to remove font file extensions (e.g., .ttf, .shx) from font names. Defaults to false.

      Returns Set<string>

      A Set containing all unique font names found in the MText string, converted to lowercase

      const mtext = "\\fArial.ttf|Hello\\fTimes New Roman.otf|World";
      const fonts = getFonts(mtext, true);
      // Returns: Set(2) { "arial", "times new roman" }