From f12842e5a4ef531e38024e16f91b21c99ce1de92 Mon Sep 17 00:00:00 2001 From: Tan Kian-ting Date: Mon, 13 Nov 2023 23:45:02 +0800 Subject: [PATCH] fix the algorithms, and try to add a bigframe initially. --- README.md | 1 + b.clo | 2 +- docs/assets/navigation.js | 2 +- docs/assets/search.js | 2 +- docs/classes/libclo.Clo.html | 104 ++++++- .../libclo_breakLines.BreakLineAlgorithm.html | 293 ++++++++++++++++++ .../canva.FontStyle.html | 75 ++--- docs/enums/canva.TextWeight.html | 11 +- docs/enums/libclo.Direction.html | 15 +- docs/enums/parser.TokenKind.html | 29 +- docs/functions/canva.fontStyleTofont.html | 9 +- docs/functions/canva.putText.html | 9 +- docs/functions/harfbuzz.harfbuzzTest.html | 58 ++++ docs/functions/index.processArgv.html | 7 +- .../libclo.calculateTextWidthHeight.html | 63 ++++ .../libclo.calculateTextWidthHeightAux.html | 63 ++++ docs/functions/libclo.filterEmptyString.html | 69 +++++ docs/functions/libclo.hyphenForClo.html | 7 +- docs/functions/libclo.hyphenTkTree.html | 10 +- docs/functions/libclo.ptToPx.html | 7 +- docs/functions/libclo.spacesToBreakpoint.html | 71 +++++ docs/functions/libclo.splitCJKV.html | 7 +- .../functions/libclo.twoReturnsToNewline.html | 22 +- docs/functions/parser.applyComment.html | 7 +- docs/functions/parser.applyContent.html | 7 +- docs/functions/parser.applyImport.html | 7 +- docs/functions/parser.applyImports.html | 7 +- docs/functions/parser.applyNotAtText.html | 7 +- docs/functions/parser.applyParts.html | 9 +- .../parser.applyPartsWithoutImport.html | 9 +- docs/functions/parser.applySegment.html | 7 +- docs/functions/parser.applySemiColon.html | 7 +- docs/functions/parser.applySpaceNL.html | 7 +- docs/functions/parser.applyText.html | 7 +- docs/functions/parser.inputTextToTree.html | 7 +- docs/functions/parser.treeToJS.html | 7 +- docs/index.html | 10 +- docs/interfaces/canva.Clo.html | 15 +- docs/interfaces/canva.CloCommand.html | 11 +- .../canva.TextStyle.html | 77 +++-- docs/interfaces/canva.fontPathPSNamePair.html | 11 +- docs/interfaces/libclo.Box.html | 44 ++- docs/interfaces/libclo.BreakPoint.html | 80 +++++ docs/interfaces/libclo.CharBox.html | 164 ++++++++++ docs/interfaces/libclo.FrameBox.html | 39 +-- docs/interfaces/libclo.HGlue.html | 80 +++++ docs/modules/canva.html | 11 +- docs/modules/harfbuzz.html | 54 ++++ docs/modules/index.html | 7 +- docs/modules/libclo.html | 20 +- docs/modules/libclo_breakLines.html | 54 ++++ docs/modules/parser.html | 7 +- docs/modules/pdfManipulate.html | 45 +++ docs/types/canva.PDFDocument.html | 7 +- docs/types/canva.TextStreamUnit.html | 7 +- docs/types/libclo.BoxesItem.html | 49 +++ docs/types/parser.tkTree.html | 7 +- docs/variables/index.helpDesc.html | 7 +- docs/variables/libclo.A4_IN_PX.html | 7 +- docs/variables/libclo.cjkvBlocksInRegex.html | 7 +- docs/variables/libclo.cjkvRegexPattern.html | 7 +- docs/variables/libclo.defaultFrameStyle.html | 7 +- docs/variables/libclo.defaultTextStyle.html | 9 +- docs/variables/parser.CONTENT.html | 7 +- docs/variables/parser.IMPORT.html | 7 +- docs/variables/parser.IMPORTEE.html | 7 +- docs/variables/parser.IMPORTS.html | 7 +- docs/variables/parser.NOT_AT.html | 7 +- docs/variables/parser.NOT_AT_TEXT.html | 7 +- docs/variables/parser.PROG.html | 7 +- docs/variables/parser.SEGMENT.html | 7 +- docs/variables/parser.SEMICOLON.html | 7 +- docs/variables/parser.lexer.html | 7 +- docs/variables/parser.outputEnd.html | 7 +- docs/variables/parser.outputHead.html | 7 +- docs/variables/parser.outputMiddle.html | 7 +- src/libclo/breakLines.js | 204 +++++++----- src/libclo/breakLines.ts | 235 +++++++++----- src/libclo/index.js | 121 +++++++- src/libclo/index.ts | 123 +++++++- 80 files changed, 2222 insertions(+), 426 deletions(-) create mode 100644 docs/classes/libclo_breakLines.BreakLineAlgorithm.html rename docs/{interfaces => enums}/canva.FontStyle.html (78%) create mode 100644 docs/functions/harfbuzz.harfbuzzTest.html create mode 100644 docs/functions/libclo.calculateTextWidthHeight.html create mode 100644 docs/functions/libclo.calculateTextWidthHeightAux.html create mode 100644 docs/functions/libclo.filterEmptyString.html create mode 100644 docs/functions/libclo.spacesToBreakpoint.html rename docs/{enums => interfaces}/canva.TextStyle.html (77%) create mode 100644 docs/interfaces/libclo.BreakPoint.html create mode 100644 docs/interfaces/libclo.CharBox.html create mode 100644 docs/interfaces/libclo.HGlue.html create mode 100644 docs/modules/harfbuzz.html create mode 100644 docs/modules/libclo_breakLines.html create mode 100644 docs/modules/pdfManipulate.html create mode 100644 docs/types/libclo.BoxesItem.html diff --git a/README.md b/README.md index 5f70399..b5717d2 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ - 20231029-30: hyphenating for english. - 20231105-06: 利用fontkit算文字的對應px寬度 initially pushed. - 20231109-10: Keng-kái oa̍h-chōa ián-sǹg-hoat. + - 20231113: the algorithm is basically fixed, and make a `bigFrame` to prepare for convert to boxes and positions. ## 之後的做法 - 先做一個前處理註冊器,註冊下列的前處理 diff --git a/b.clo b/b.clo index 41a9b70..5c654a2 100644 --- a/b.clo +++ b/b.clo @@ -1,2 +1,2 @@ --- -The book of the generation of Jesus Christ, the son of David, \ No newline at end of file +In the beginning was the Word, and the Word was with God, and the Word was God. The same was in the beginning with God. \ No newline at end of file diff --git a/docs/assets/navigation.js b/docs/assets/navigation.js index 480dcb9..89a89a0 100644 --- a/docs/assets/navigation.js +++ b/docs/assets/navigation.js @@ -1 +1 @@ -window.navigationData = "data:application/octet-stream;base64,H4sIAAAAAAAAA42XW0/bMBSA/0ue0TYYsI230gZWoGnUZAMJocqkbuPVsaPEKa2m/fe5iZM6t+M8leZ8/hpfzvHh9a8l8F5YN1aA2A5ZZ1aMRCi/RnyVUZx+zh9/CkVEZWxL2Mq6uTizgpDQVYKZdfNaCXz54YkDxScJZllUKqpwXfb931nN8IzJJhT9iiLe7xhTfhpMmMDJGgXVPGS0MZer6/rgMY8iJCOgQ0GQ6o6z5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wadxuL24j84fRXmsk150Y53TJj+30jIx66D2tYjoduSCof80waQ1Qh4L0p3+xViJC3v4QP3CzPcq+2/vv0PRTFWxwIVAAA=" \ No newline at end of file diff --git a/docs/assets/search.js b/docs/assets/search.js index 3251eaf..318c86f 100644 --- a/docs/assets/search.js +++ b/docs/assets/search.js @@ -1 +1 @@ -window.searchData = "data:application/octet-stream;base64,H4sIAAAAAAAAA62cW1ejyhLHv0vy6naHO/jmOM4+7uOoR7Mva7lmudCgsk0CB4g6Z9Z890M1BKpIFZfg00xMVf+761dddDeQH5MkeksnR7c/Ji/hejE50g8ma38VTI4my/D+YRlNDiabZJl/XEWLzTJIfy3+fPicrZb5dw9LP02DvIHJ5OfBtg3brBqJs3l09V418rhZP2RhtK6aKb5nWjuYxH4SrLO6I2z72Vt0HWSbZJ3Oo4vgbRmuA1mMMd5fOY2XYXby+7//lPUqk/1Vnr/Hz8H6S5ScIBQ7QthqrNb8ZZ4ELUHEVgO13Erqc5gEqtlKJ1hvVpVG9fVAAc2uFM7n133anhZ2be3XHrzS9fy8l1JhN0ZpPv/US6mwG6P0aT7vpVTYDVbSrVrqS5L/+ymqa0S4zoLk0X+oa83WZGg2zPQ6uRfbbpyt03ARnONC0aE45X1bR12NSujOvZ+qdtKXMO7dj4bTqA70jvf0nUhl6eKXMP0lXD8HSZgFiz2kv/eW/v7R0o/ROrvJvi/7s8ceH9qVxU4J7J2GH92Vt3CRPffuxtb6Q7vwHIRPz1nvPlTmH9qJh5w1OPTtRW0/thu4ILbXwpFlsE/TjRnPjGDPyS3M62ECfaZwx+wdJthnonbM0WGCXdOxZSYOE+qcdG3zbZhU99RqnVWdYka9bzk2784u7q7+rrRe/ST079HeZWsxdKlsWUY9Te/usu9x0FNkWlm3jqnqeq/M6CV52CtJKs+yn/0Spl8H+uWO3AOEdhE8+ptlNg/eGyVgpydNy4GodzVV0e4nWpvur/rwz8vrp2X08JKera+Dp+BdVt0xHaeqmrjys3x+rttFseXQa5Je7wXxzrZ036oM385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eM1189lhwCQYFl5zC96kDnSB67lsN8HTVmnztBVcIkPrbbbj+AE/mNhhFmODTb6FOi7f+As6ADKDy2WGCjZQX+ADdAFHNnnUBO0IbaDksEqZXlmBZSCDpalYd+H7Dh4YGZ8LmGrNhuAAGqNVMFm4AyYSzl3cYJaPQ7XrPEylifas3PiUbXT2C7BcL9glWJqjJOhDoxccIlHfd4DvO9woNc/bdTzPA+oeFzpYvdiaU/tseKdA3mLjmiJuMlig83a1x3O4LJe1n78CLQAPYytoGbG3htEj2GpO+T1ooIYqqpxS94aIDfTYDFO+RzZP6E2ID7KUz0NvolwWdBHVcP3IegoeHxsEAs9p+XrIh0AvcMrza8CrOUbL2qFcKL+o794D5wa+3avcKTzCBWXpUPLYVfkfoy6Vsje01A2AblUCBnbdGDco3c28BdTZEnouv6ykHviEmmAc2Aq6ejN3Z28FgtJjh7DW1G50eMBbPd7gVpnanIFOu6zpxUjlyX9RYrKA5WzxOc/vUWzAYF5wLp5/S9Lyldd5Etfvxwa9BsnI5xJxZyEqkMuJ2sOMphhf/4W9m6ntpOAOs6z6yuZqr2MXc9rGCi3IrLqVuopO3w/+cnK0i3ZlxfzN5y8/f/4fkqlvCx+FAAA="; \ No newline at end of file diff --git a/docs/classes/libclo.Clo.html b/docs/classes/libclo.Clo.html index 272a378..4e22b3e 100644 --- a/docs/classes/libclo.Clo.html +++ b/docs/classes/libclo.Clo.html @@ -25,7 +25,7 @@ +
  • Defined in libclo/index.ts:381
  • @@ -45,7 +45,11 @@

    Methods

    @@ -57,7 +61,7 @@
  • Returns Clo

  • +
  • Defined in libclo/index.ts:390
  • Properties

    @@ -72,7 +76,7 @@
    [index: string]: any
    +
  • Defined in libclo/index.ts:387
  • mainStream: string[]
    @@ -80,7 +84,7 @@
    +
  • Defined in libclo/index.ts:383
  • preprocessors: Function[]
    @@ -88,17 +92,17 @@
    +
  • Defined in libclo/index.ts:385
  • Methods

      - +
    • -

      Returns void

    +
  • Defined in libclo/index.ts:430
  • Returns any

    +
  • Defined in libclo/index.ts:413
  • +
    + +
    +
  • Defined in libclo/index.ts:426
  • +
    + +
    +
    + +
    +
    + +

    Returns void

    +
  • Defined in libclo/index.ts:409
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/classes/libclo_breakLines.BreakLineAlgorithm.html b/docs/classes/libclo_breakLines.BreakLineAlgorithm.html new file mode 100644 index 0000000..1cdea8f --- /dev/null +++ b/docs/classes/libclo_breakLines.BreakLineAlgorithm.html @@ -0,0 +1,293 @@ +BreakLineAlgorithm | clo
    +
    + +
    +
    +
    +
    + +

    Class BreakLineAlgorithm

    +
    +

    Algorithms in LATEX-like language

    +
    +
    +
    +

    Hierarchy

    +
      +
    • BreakLineAlgorithm
    +
    +
    +
    + +
    +
    +

    Constructors

    +
    + +
    +
    +

    Properties

    +
    + +
    lineCostStorage: number[][]
    +
    + +
    prevNodes: number[]
    +
    + +
    totalCostAuxStorage: number[]
    +
    +

    Methods

    +
    + +
      + +
    • +

      genrate the list of point of breaking line. it returns a correct list ascending

      +
      +

      Returns number[]

      +
    +
    + +
    +
    + +
      + +
    • +

      check if a boeitem is BreakPoint Type

      +
      +
      +

      Parameters

      +
        +
      • +
        item: any
      +

      Returns item is HGlue

      +
    +
    + +
      + +
    • +

      check the line cost of a line containing items[i..j]

      +
      +
      +

      Parameters

      +
        +
      • +
        items: BoxesItem[]
        +

        items of box

        +
        +
      • +
      • +
        i: number
        +

        beginning (excluded)

        +
        +
      • +
      • +
        j: number
        +

        end of the line

        +
        +
      • +
      • +
        lineWidth: number
        +

        line width

        +
        +
      +

      Returns number

      +
    +
    + +
      + +
    • +

      measuring new-line triggered advance width

      +
      +
      +

      Parameters

      +
      +

      Returns number

      +
    +
    + +
    +
    + +
    +
    + +
      + +
    • +

      check all the total cost of paragraphes of the segnemt

      +
      +
      +

      Parameters

      +
      +

      Returns number

      +
    +
    + +
      + +
    • +

      check the total cost item[0..j].

      +
      +
      +

      Parameters

      +
        +
      • +
        items: BoxesItem[]
        +
      • +
      • +
        j: number
      • +
      • +
        lineWidth: number
        +
      +

      Returns number

      +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/interfaces/canva.FontStyle.html b/docs/enums/canva.FontStyle.html similarity index 78% rename from docs/interfaces/canva.FontStyle.html rename to docs/enums/canva.FontStyle.html index 98e96f5..c29430b 100644 --- a/docs/interfaces/canva.FontStyle.html +++ b/docs/enums/canva.FontStyle.html @@ -15,61 +15,37 @@
  • clo
  • canva
  • FontStyle
  • -

    Interface FontStyle

    -
    -

    Font Style Interface -family : eg. "FreeSans" -size : in px, not in pt. -textWeight : TextWeight.REGULAR ,etc -textWeight : TextStyle.ITALIC ,etc

    -
    -
    -
    -

    Hierarchy

    -
    -

    Properties

    -
    color? -family -size -textStyle -textWeight +

    Enumeration Members

    +
    -

    Properties

    -
    - -
    color?: string
    +
  • Defined in canva.ts:47
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/enums/canva.TextWeight.html b/docs/enums/canva.TextWeight.html index 57642a0..dd84bd1 100644 --- a/docs/enums/canva.TextWeight.html +++ b/docs/enums/canva.TextWeight.html @@ -17,7 +17,7 @@
  • TextWeight
  • Enumeration TextWeight

    +
  • Defined in canva.ts:39
  • @@ -34,12 +34,12 @@
    BOLD: 1
    +
  • Defined in canva.ts:41
  • REGULAR: 0
    +
  • Defined in canva.ts:40
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/enums/libclo.Direction.html b/docs/enums/libclo.Direction.html index 9d2c8ea..30b539b 100644 --- a/docs/enums/libclo.Direction.html +++ b/docs/enums/libclo.Direction.html @@ -24,7 +24,7 @@ etc.

    +
  • Defined in libclo/index.ts:19
  • @@ -43,22 +43,22 @@ etc.

    BTT: 3
    +
  • Defined in libclo/index.ts:23
  • LTR: 0
    +
  • Defined in libclo/index.ts:20
  • RTL: 1
    +
  • Defined in libclo/index.ts:21
  • TTB: 2
    +
  • Defined in libclo/index.ts:22
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/enums/parser.TokenKind.html b/docs/enums/parser.TokenKind.html index 3645041..6f29911 100644 --- a/docs/enums/parser.TokenKind.html +++ b/docs/enums/parser.TokenKind.html @@ -17,7 +17,7 @@
  • TokenKind
  • Enumeration TokenKind

    +
  • Defined in parser.ts:36
  • @@ -43,57 +43,57 @@
    Comment: 10
    +
  • Defined in parser.ts:47
  • ExcapeAt: 5
    +
  • Defined in parser.ts:42
  • ExprMark: 4
    +
  • Defined in parser.ts:41
  • Id: 8
    +
  • Defined in parser.ts:45
  • Number: 2
    +
  • Defined in parser.ts:39
  • Op: 3
    +
  • Defined in parser.ts:40
  • Paren: 6
    +
  • Defined in parser.ts:43
  • Semicolon: 1
    +
  • Defined in parser.ts:38
  • Seperator: 0
    +
  • Defined in parser.ts:37
  • SpaceNL: 7
    +
  • Defined in parser.ts:44
  • Str: 9
    +
  • Defined in parser.ts:46
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/canva.fontStyleTofont.html b/docs/functions/canva.fontStyleTofont.html index 84a4a6c..d15a792 100644 --- a/docs/functions/canva.fontStyleTofont.html +++ b/docs/functions/canva.fontStyleTofont.html @@ -26,7 +26,7 @@

    Parameters

    @@ -34,7 +34,7 @@
    +
  • Defined in canva.ts:60
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/canva.putText.html b/docs/functions/canva.putText.html index 34adcce..5038f32 100644 --- a/docs/functions/canva.putText.html +++ b/docs/functions/canva.putText.html @@ -36,7 +36,7 @@
  • -
    sty: FontStyle
    +
    sty: TextStyle

    input fontstyle

  • @@ -56,7 +56,7 @@
    +
  • Defined in canva.ts:96
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/harfbuzz.harfbuzzTest.html b/docs/functions/harfbuzz.harfbuzzTest.html new file mode 100644 index 0000000..58f8343 --- /dev/null +++ b/docs/functions/harfbuzz.harfbuzzTest.html @@ -0,0 +1,58 @@ +harfbuzzTest | clo
    +
    + +
    +
    +
    +
    + +

    Function harfbuzzTest

    +
    +
      + +
    • +
      +

      Parameters

      +
        +
      • +
        inputString: string
      +

      Returns void

    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/functions/index.processArgv.html b/docs/functions/index.processArgv.html index 684129a..74af77b 100644 --- a/docs/functions/index.processArgv.html +++ b/docs/functions/index.processArgv.html @@ -32,7 +32,7 @@

    Returns void

    +
  • Defined in index.ts:33
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/libclo.calculateTextWidthHeight.html b/docs/functions/libclo.calculateTextWidthHeight.html new file mode 100644 index 0000000..93ba608 --- /dev/null +++ b/docs/functions/libclo.calculateTextWidthHeight.html @@ -0,0 +1,63 @@ +calculateTextWidthHeight | clo
    +
    + +
    +
    +
    +
    + +

    Function calculateTextWidthHeight

    +
    +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/functions/libclo.calculateTextWidthHeightAux.html b/docs/functions/libclo.calculateTextWidthHeightAux.html new file mode 100644 index 0000000..6e0bf50 --- /dev/null +++ b/docs/functions/libclo.calculateTextWidthHeightAux.html @@ -0,0 +1,63 @@ +calculateTextWidthHeightAux | clo
    +
    + +
    +
    +
    +
    + +

    Function calculateTextWidthHeightAux

    +
    +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/functions/libclo.filterEmptyString.html b/docs/functions/libclo.filterEmptyString.html new file mode 100644 index 0000000..1016f0a --- /dev/null +++ b/docs/functions/libclo.filterEmptyString.html @@ -0,0 +1,69 @@ +filterEmptyString | clo
    +
    + +
    +
    +
    +
    + +

    Function filterEmptyString

    +
    +
      + +
    • +

      remove all the `` (empty string) in the arr

      +
      +
      +

      Parameters

      +
        +
      • +
        arr: tkTree
        +

        the tkTree to be filtered

        +
        +
      • +
      • +
        clo: Clo
        +

        the Clo file

        +
        +
      +

      Returns tkTree

      +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/functions/libclo.hyphenForClo.html b/docs/functions/libclo.hyphenForClo.html index 1a814a9..3da54d0 100644 --- a/docs/functions/libclo.hyphenForClo.html +++ b/docs/functions/libclo.hyphenForClo.html @@ -38,7 +38,7 @@

    Returns tkTree

    +
  • Defined in libclo/index.ts:197
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/libclo.hyphenTkTree.html b/docs/functions/libclo.hyphenTkTree.html index b6a0c6b..4c3500a 100644 --- a/docs/functions/libclo.hyphenTkTree.html +++ b/docs/functions/libclo.hyphenTkTree.html @@ -21,6 +21,9 @@
  • hyphenate for a tkTree

    +
      +
    • hyphenation => ["bp", "", "-"]
    • +

    Parameters

    @@ -38,7 +41,7 @@

    Returns tkTree

  • +
  • Defined in libclo/index.ts:252
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/libclo.ptToPx.html b/docs/functions/libclo.ptToPx.html index 761658b..7f44945 100644 --- a/docs/functions/libclo.ptToPx.html +++ b/docs/functions/libclo.ptToPx.html @@ -34,7 +34,7 @@
    +
  • Defined in libclo/index.ts:124
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/libclo.spacesToBreakpoint.html b/docs/functions/libclo.spacesToBreakpoint.html new file mode 100644 index 0000000..f79de68 --- /dev/null +++ b/docs/functions/libclo.spacesToBreakpoint.html @@ -0,0 +1,71 @@ +spacesToBreakpoint | clo
    +
    + +
    +
    +
    +
    + +

    Function spacesToBreakpoint

    +
    +
      + +
    • +

      convert spaces to Breakpoint +\s+ => ["bp" [\s+] ""]

      +
      +
      +

      Parameters

      +
        +
      • +
        arr: tkTree
        +

        the tkTree input text stream

        +
        +
      • +
      • +
        clo: Clo
        +

        the Clo object

        +
        +
      +

      Returns tkTree

      the converted object

      + +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/functions/libclo.splitCJKV.html b/docs/functions/libclo.splitCJKV.html index 7efea68..53645f2 100644 --- a/docs/functions/libclo.splitCJKV.html +++ b/docs/functions/libclo.splitCJKV.html @@ -41,7 +41,7 @@
    +
  • Defined in libclo/index.ts:177
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/libclo.twoReturnsToNewline.html b/docs/functions/libclo.twoReturnsToNewline.html index 7ff24e8..715ab9a 100644 --- a/docs/functions/libclo.twoReturnsToNewline.html +++ b/docs/functions/libclo.twoReturnsToNewline.html @@ -20,19 +20,26 @@ +

    Returns tkTree

    the input tktree

    +
    +
  • Defined in libclo/index.ts:140
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyComment.html b/docs/functions/parser.applyComment.html index 914527c..bf2b6f2 100644 --- a/docs/functions/parser.applyComment.html +++ b/docs/functions/parser.applyComment.html @@ -27,7 +27,7 @@
    value: Token<Comment>

    Returns tkTree[]

    +
  • Defined in parser.ts:108
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyContent.html b/docs/functions/parser.applyContent.html index 02d8312..18d9431 100644 --- a/docs/functions/parser.applyContent.html +++ b/docs/functions/parser.applyContent.html @@ -27,7 +27,7 @@
    input: tkTree[]

    Returns tkTree[]

    +
  • Defined in parser.ts:147
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyImport.html b/docs/functions/parser.applyImport.html index 1def428..83218a1 100644 --- a/docs/functions/parser.applyImport.html +++ b/docs/functions/parser.applyImport.html @@ -27,7 +27,7 @@
    input: [Token<TokenKind>, Token<TokenKind>[], tkTree]

    Returns tkTree

    +
  • Defined in parser.ts:113
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyImports.html b/docs/functions/parser.applyImports.html index 9e69db1..f6f26f6 100644 --- a/docs/functions/parser.applyImports.html +++ b/docs/functions/parser.applyImports.html @@ -27,7 +27,7 @@
    input: [tkTree, tkTree[]]

    Returns tkTree

    +
  • Defined in parser.ts:127
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyNotAtText.html b/docs/functions/parser.applyNotAtText.html index 0c18dd4..9b1942d 100644 --- a/docs/functions/parser.applyNotAtText.html +++ b/docs/functions/parser.applyNotAtText.html @@ -27,7 +27,7 @@
    value: Token<TokenKind>

    Returns tkTree

    +
  • Defined in parser.ts:136
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyParts.html b/docs/functions/parser.applyParts.html index 2d7e34a..872c03f 100644 --- a/docs/functions/parser.applyParts.html +++ b/docs/functions/parser.applyParts.html @@ -26,10 +26,10 @@
  • first: tkTree
  • -
    second: [Token<TokenKind>, tkTree]
  • +
    second: [Token<TokenKind>, Token<TokenKind>, tkTree]

    Returns tkTree

    +
  • Defined in parser.ts:97
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyPartsWithoutImport.html b/docs/functions/parser.applyPartsWithoutImport.html index 94f8ae5..e06a97b 100644 --- a/docs/functions/parser.applyPartsWithoutImport.html +++ b/docs/functions/parser.applyPartsWithoutImport.html @@ -24,10 +24,10 @@

    Parameters

    +
    parsed: [Token<TokenKind>, Token<TokenKind>, tkTree]

    Returns tkTree

    +
  • Defined in parser.ts:102
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applySegment.html b/docs/functions/parser.applySegment.html index 14c3482..b532642 100644 --- a/docs/functions/parser.applySegment.html +++ b/docs/functions/parser.applySegment.html @@ -27,7 +27,7 @@
    input: [Token<TokenKind>, Token<TokenKind>[], Token<TokenKind>]

    Returns tkTree[]

    +
  • Defined in parser.ts:87
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applySemiColon.html b/docs/functions/parser.applySemiColon.html index bca4cce..a6c3830 100644 --- a/docs/functions/parser.applySemiColon.html +++ b/docs/functions/parser.applySemiColon.html @@ -27,7 +27,7 @@
    value: Token<Semicolon>

    Returns tkTree

    +
  • Defined in parser.ts:93
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applySpaceNL.html b/docs/functions/parser.applySpaceNL.html index 77be86d..922a86f 100644 --- a/docs/functions/parser.applySpaceNL.html +++ b/docs/functions/parser.applySpaceNL.html @@ -27,7 +27,7 @@
    value: Token<SpaceNL>

    Returns tkTree

    +
  • Defined in parser.ts:151
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.applyText.html b/docs/functions/parser.applyText.html index 2e78006..a1c1b3c 100644 --- a/docs/functions/parser.applyText.html +++ b/docs/functions/parser.applyText.html @@ -27,7 +27,7 @@
    input: tkTree

    Returns tkTree[]

    +
  • Defined in parser.ts:143
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.inputTextToTree.html b/docs/functions/parser.inputTextToTree.html index f8e3946..248cef0 100644 --- a/docs/functions/parser.inputTextToTree.html +++ b/docs/functions/parser.inputTextToTree.html @@ -30,7 +30,7 @@

    Returns tkTree

    +
  • Defined in parser.ts:353
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/functions/parser.treeToJS.html b/docs/functions/parser.treeToJS.html index 8c2be8e..bc3f48b 100644 --- a/docs/functions/parser.treeToJS.html +++ b/docs/functions/parser.treeToJS.html @@ -30,7 +30,7 @@

    Returns string

    +
  • Defined in parser.ts:275
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 0739e0d..7227477 100644 --- a/docs/index.html +++ b/docs/index.html @@ -44,7 +44,10 @@
  • 20231023-24:fix .ttc bug.
  • 20231026-27 : clo basic interface, preprocessor of stream of text, add cjk-english splitter, etc.
  • -
  • 20231029: hyphenating for english.
  • +
  • 20231029-30: hyphenating for english.
  • +
  • 20231105-06: 利用fontkit算文字的對應px寬度 initially pushed.
  • +
  • 20231109-10: Keng-kái oa̍h-chōa ián-sǹg-hoat.
  • +
  • 20231113: the algorithm is basically fixed, and make a bigFrame to prepare for convert to boxes and positions.
  • 之後的做法

    @@ -43,17 +43,17 @@
    PDFCanvas: PDFDocument
    +
  • Defined in canva.ts:20
  • -
    mainFontStyle?: FontStyle
    +
  • Defined in canva.ts:19
  • mainText: TextStreamUnit[]
    +
  • Defined in canva.ts:18
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/canva.CloCommand.html b/docs/interfaces/canva.CloCommand.html index 18b816b..5fe1ae3 100644 --- a/docs/interfaces/canva.CloCommand.html +++ b/docs/interfaces/canva.CloCommand.html @@ -21,7 +21,7 @@ +
  • Defined in canva.ts:6
  • @@ -38,12 +38,12 @@
    +
  • Defined in canva.ts:8
  • cmdName: string
    +
  • Defined in canva.ts:7
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/enums/canva.TextStyle.html b/docs/interfaces/canva.TextStyle.html similarity index 77% rename from docs/enums/canva.TextStyle.html rename to docs/interfaces/canva.TextStyle.html index 0d618ec..ccbd8b0 100644 --- a/docs/enums/canva.TextStyle.html +++ b/docs/interfaces/canva.TextStyle.html @@ -15,37 +15,63 @@
  • clo
  • canva
  • TextStyle
  • -

    Enumeration TextStyle

    +
  • family : eg. "FreeSans"
  • +
  • size : in px, not in pt.
  • +
  • textWeight : TextWeight.REGULAR ,etc
  • +
  • fontStyle : FontStyle.ITALIC ,etc
  • + + +
    +
    +

    Hierarchy

    +
    -

    Enumeration Members

    -
    -

    Enumeration Members

    -
    - -
    ITALIC: 1
    +
  • Defined in canva.ts:34
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/canva.fontPathPSNamePair.html b/docs/interfaces/canva.fontPathPSNamePair.html index 4b9c0bf..3b51ad5 100644 --- a/docs/interfaces/canva.fontPathPSNamePair.html +++ b/docs/interfaces/canva.fontPathPSNamePair.html @@ -21,7 +21,7 @@ +
  • Defined in canva.ts:50
  • @@ -38,12 +38,12 @@
    path: string
    +
  • Defined in canva.ts:51
  • psName: string
    +
  • Defined in canva.ts:52
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/libclo.Box.html b/docs/interfaces/libclo.Box.html index ca1355d..e15b0a1 100644 --- a/docs/interfaces/libclo.Box.html +++ b/docs/interfaces/libclo.Box.html @@ -18,6 +18,14 @@

    Interface Box

    a basic Box

    +
      +
    • x :
    • +
    • y :
    • +
    • textStyle :
    • +
    • direction :
    • +
    • width : x_advance
    • +
    • content :
    • +
    @@ -25,9 +33,10 @@
    @@ -37,8 +46,8 @@

    Properties

    content direction -fontStyle height +textStyle width x y @@ -49,37 +58,37 @@
    content: null | string | Box[]
    +
  • Defined in libclo/index.ts:75
  • direction: Direction
    -
    - -
    fontStyle: null | FontStyle
    +
  • Defined in libclo/index.ts:72
  • height: number
    +
  • Defined in libclo/index.ts:74
  • +
    + +
    textStyle: null | TextStyle
    width: number
    +
  • Defined in libclo/index.ts:73
  • x: null | number
    +
  • Defined in libclo/index.ts:69
  • y: null | number
    +
  • Defined in libclo/index.ts:70
  • @@ -110,9 +119,12 @@
    +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/libclo.BreakPoint.html b/docs/interfaces/libclo.BreakPoint.html new file mode 100644 index 0000000..37b97dd --- /dev/null +++ b/docs/interfaces/libclo.BreakPoint.html @@ -0,0 +1,80 @@ +BreakPoint | clo
    +
    + +
    +
    +
    +
    + +

    Interface BreakPoint

    +
    +

    Hierarchy

    +
      +
    • BreakPoint
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    newLined: BoxesItem
    +
    + +
    original: BoxesItem
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/interfaces/libclo.CharBox.html b/docs/interfaces/libclo.CharBox.html new file mode 100644 index 0000000..6a9cf82 --- /dev/null +++ b/docs/interfaces/libclo.CharBox.html @@ -0,0 +1,164 @@ +CharBox | clo
    +
    + +
    +
    +
    +
    + +

    Interface CharBox

    +
    +

    a basic Box

    +
      +
    • x :
    • +
    • y :
    • +
    • textStyle :
    • +
    • direction :
    • +
    • width : x_advance
    • +
    • content :
    • +
    +
    +
    +
    +

    Hierarchy

    +
      +
    • Box +
        +
      • CharBox
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    content: null | string | Box[]
    +
    + +
    direction: Direction
    +
    + +
    height: number
    +
    + +
    maxX: number
    +
    + +
    maxY: number
    +
    + +
    minX: number
    +
    + +
    minY: number
    +
    + +
    textStyle: null | TextStyle
    +
    + +
    width: number
    +
    + +
    x: null | number
    +
    + +
    y: null | number
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/interfaces/libclo.FrameBox.html b/docs/interfaces/libclo.FrameBox.html index d4feb07..cc295e9 100644 --- a/docs/interfaces/libclo.FrameBox.html +++ b/docs/interfaces/libclo.FrameBox.html @@ -31,7 +31,7 @@ +
  • Defined in libclo/index.ts:46
  • @@ -43,8 +43,8 @@ content direction directionInsideLine -fontStyle height +textStyle width x y @@ -55,54 +55,54 @@
    baseLineskip: null | number
    +
  • Defined in libclo/index.ts:48
  • content: null | string | Box[]
    +
  • Defined in libclo/index.ts:75
  • direction: Direction
    +
  • Defined in libclo/index.ts:72
  • directionInsideLine: Direction
    -
    - -
    fontStyle: null | FontStyle
    +
  • Defined in libclo/index.ts:47
  • height: number
    +
  • Defined in libclo/index.ts:74
  • +
    + +
    textStyle: null | TextStyle
    width: number
    +
  • Defined in libclo/index.ts:73
  • x: null | number
    +
  • Defined in libclo/index.ts:69
  • y: null | number
    +
  • Defined in libclo/index.ts:70
  • @@ -135,9 +135,12 @@
    +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/interfaces/libclo.HGlue.html b/docs/interfaces/libclo.HGlue.html new file mode 100644 index 0000000..65b3763 --- /dev/null +++ b/docs/interfaces/libclo.HGlue.html @@ -0,0 +1,80 @@ +HGlue | clo
    +
    + +
    +
    +
    +
    + +

    Interface HGlue

    +
    +

    Horizonal glue.

    +
      +
    • stretchFactor : the stretch factor in float
    • +
    +
    +
    +
    +

    Hierarchy

    +
      +
    • HGlue
    +
    +
    +
    + +
    +
    +

    Properties

    +
    +
    +

    Properties

    +
    + +
    stretchFactor: number
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/modules/canva.html b/docs/modules/canva.html index f3def10..04da158 100644 --- a/docs/modules/canva.html +++ b/docs/modules/canva.html @@ -16,20 +16,20 @@
  • canva
  • Module canva

    +
  • Defined in canva.ts:1
  • Index

    Enumerations

    -

    Interfaces

    @@ -61,9 +61,12 @@ +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/modules/harfbuzz.html b/docs/modules/harfbuzz.html new file mode 100644 index 0000000..eb059d2 --- /dev/null +++ b/docs/modules/harfbuzz.html @@ -0,0 +1,54 @@ +harfbuzz | clo
    +
    + +
    +
    +
    +
    + +

    Module harfbuzz

    +
    +
    +

    Index

    +
    +

    Functions

    +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/modules/index.html b/docs/modules/index.html index c101749..b408c04 100644 --- a/docs/modules/index.html +++ b/docs/modules/index.html @@ -16,7 +16,7 @@
  • index
  • Module index

    +
  • Defined in index.ts:1
  • Index

    @@ -47,9 +47,12 @@ +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/modules/libclo.html b/docs/modules/libclo.html index a9ab697..50b3d48 100644 --- a/docs/modules/libclo.html +++ b/docs/modules/libclo.html @@ -16,7 +16,7 @@
  • libclo
  • Module libclo

    +
  • Defined in libclo/index.ts:1
  • Index

    @@ -31,7 +31,14 @@

    Interfaces

    +
    +

    Type Aliases

    +

    Variables

    @@ -43,9 +50,13 @@

    Functions

    -
    @@ -68,9 +79,12 @@ +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/modules/libclo_breakLines.html b/docs/modules/libclo_breakLines.html new file mode 100644 index 0000000..6732593 --- /dev/null +++ b/docs/modules/libclo_breakLines.html @@ -0,0 +1,54 @@ +libclo/breakLines | clo
    +
    + +
    +
    +
    +
    + +

    Module libclo/breakLines

    +
    +
    +

    Index

    +
    +

    Classes

    +
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/modules/parser.html b/docs/modules/parser.html index d3f0230..9bd9078 100644 --- a/docs/modules/parser.html +++ b/docs/modules/parser.html @@ -16,7 +16,7 @@
  • parser
  • Module parser

    +
  • Defined in parser.ts:1
  • Index

    @@ -79,9 +79,12 @@ +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/modules/pdfManipulate.html b/docs/modules/pdfManipulate.html new file mode 100644 index 0000000..dc7de74 --- /dev/null +++ b/docs/modules/pdfManipulate.html @@ -0,0 +1,45 @@ +pdfManipulate | clo
    +
    + +
    +
    +
    +
    + +

    Module pdfManipulate

    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/types/canva.PDFDocument.html b/docs/types/canva.PDFDocument.html index 017dcef..871d9ae 100644 --- a/docs/types/canva.PDFDocument.html +++ b/docs/types/canva.PDFDocument.html @@ -18,7 +18,7 @@

    Type alias PDFDocument

    PDFDocument: PDFKit.PDFDocument
    +
  • Defined in canva.ts:13
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/canva.TextStreamUnit.html b/docs/types/canva.TextStreamUnit.html index d46ca41..7633240 100644 --- a/docs/types/canva.TextStreamUnit.html +++ b/docs/types/canva.TextStreamUnit.html @@ -18,7 +18,7 @@

    Type alias TextStreamUnit

    TextStreamUnit: string | CloCommand
    +
  • Defined in canva.ts:12
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/types/libclo.BoxesItem.html b/docs/types/libclo.BoxesItem.html new file mode 100644 index 0000000..9e468c9 --- /dev/null +++ b/docs/types/libclo.BoxesItem.html @@ -0,0 +1,49 @@ +BoxesItem | clo
    +
    + +
    +
    +
    +
    + +

    Type alias BoxesItem

    +
    BoxesItem: HGlue | Box | BreakPoint | BoxesItem[]
    +
    + +
    +
    +

    Generated using TypeDoc

    +
    \ No newline at end of file diff --git a/docs/types/parser.tkTree.html b/docs/types/parser.tkTree.html index 1587548..9fa9d27 100644 --- a/docs/types/parser.tkTree.html +++ b/docs/types/parser.tkTree.html @@ -39,7 +39,7 @@ }

    +
  • Defined in parser.ts:34
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/index.helpDesc.html b/docs/variables/index.helpDesc.html index 46a1209..607774b 100644 --- a/docs/variables/index.helpDesc.html +++ b/docs/variables/index.helpDesc.html @@ -21,7 +21,7 @@
    +
  • Defined in index.ts:9
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/libclo.A4_IN_PX.html b/docs/variables/libclo.A4_IN_PX.html index 73543dc..49a1fff 100644 --- a/docs/variables/libclo.A4_IN_PX.html +++ b/docs/variables/libclo.A4_IN_PX.html @@ -28,7 +28,7 @@
    width: number
    +
  • Defined in libclo/index.ts:82
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/libclo.cjkvBlocksInRegex.html b/docs/variables/libclo.cjkvBlocksInRegex.html index 1aa9e5c..a6863ed 100644 --- a/docs/variables/libclo.cjkvBlocksInRegex.html +++ b/docs/variables/libclo.cjkvBlocksInRegex.html @@ -28,7 +28,7 @@
    +
  • Defined in libclo/index.ts:112
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/libclo.cjkvRegexPattern.html b/docs/variables/libclo.cjkvRegexPattern.html index b276087..014fc48 100644 --- a/docs/variables/libclo.cjkvRegexPattern.html +++ b/docs/variables/libclo.cjkvRegexPattern.html @@ -18,7 +18,7 @@

    Variable cjkvRegexPatternConst

    cjkvRegexPattern: RegExp = ...
    +
  • Defined in libclo/index.ts:114
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/libclo.defaultFrameStyle.html b/docs/variables/libclo.defaultFrameStyle.html index 410f596..d2ea7e3 100644 --- a/docs/variables/libclo.defaultFrameStyle.html +++ b/docs/variables/libclo.defaultFrameStyle.html @@ -18,7 +18,7 @@

    Variable defaultFrameStyleConst

    defaultFrameStyle: FrameBox = ...
    +
  • Defined in libclo/index.ts:92
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/libclo.defaultTextStyle.html b/docs/variables/libclo.defaultTextStyle.html index 4d6615f..2b881b9 100644 --- a/docs/variables/libclo.defaultTextStyle.html +++ b/docs/variables/libclo.defaultTextStyle.html @@ -16,9 +16,9 @@
  • libclo
  • defaultTextStyle
  • Variable defaultTextStyleConst

    -
    defaultTextStyle: FontStyle = ...
    +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.CONTENT.html b/docs/variables/parser.CONTENT.html index fb5d2be..38d0eef 100644 --- a/docs/variables/parser.CONTENT.html +++ b/docs/variables/parser.CONTENT.html @@ -18,7 +18,7 @@

    Variable CONTENTConst

    CONTENT: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:84
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.IMPORT.html b/docs/variables/parser.IMPORT.html index d8971c3..8099f82 100644 --- a/docs/variables/parser.IMPORT.html +++ b/docs/variables/parser.IMPORT.html @@ -18,7 +18,7 @@

    Variable IMPORTConst

    IMPORT: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:80
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.IMPORTEE.html b/docs/variables/parser.IMPORTEE.html index d87dd66..ebbc08e 100644 --- a/docs/variables/parser.IMPORTEE.html +++ b/docs/variables/parser.IMPORTEE.html @@ -21,7 +21,7 @@
    +
  • Defined in parser.ts:158
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.IMPORTS.html b/docs/variables/parser.IMPORTS.html index 38b04fc..f21108e 100644 --- a/docs/variables/parser.IMPORTS.html +++ b/docs/variables/parser.IMPORTS.html @@ -18,7 +18,7 @@

    Variable IMPORTSConst

    IMPORTS: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:81
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.NOT_AT.html b/docs/variables/parser.NOT_AT.html index 62206da..b93f91b 100644 --- a/docs/variables/parser.NOT_AT.html +++ b/docs/variables/parser.NOT_AT.html @@ -18,7 +18,7 @@

    Variable NOT_AT

    NOT_AT: Parser<TokenKind, Token<TokenKind>> = ...
    +
  • Defined in parser.ts:166
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.NOT_AT_TEXT.html b/docs/variables/parser.NOT_AT_TEXT.html index 52c4c41..5ab3d33 100644 --- a/docs/variables/parser.NOT_AT_TEXT.html +++ b/docs/variables/parser.NOT_AT_TEXT.html @@ -18,7 +18,7 @@

    Variable NOT_AT_TEXTConst

    NOT_AT_TEXT: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:83
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.PROG.html b/docs/variables/parser.PROG.html index ab47984..8d9911c 100644 --- a/docs/variables/parser.PROG.html +++ b/docs/variables/parser.PROG.html @@ -20,7 +20,7 @@
    +
  • Defined in parser.ts:78
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.SEGMENT.html b/docs/variables/parser.SEGMENT.html index 029eca3..da8be78 100644 --- a/docs/variables/parser.SEGMENT.html +++ b/docs/variables/parser.SEGMENT.html @@ -18,7 +18,7 @@

    Variable SEGMENTConst

    SEGMENT: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:79
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.SEMICOLON.html b/docs/variables/parser.SEMICOLON.html index e66ad01..697e8ee 100644 --- a/docs/variables/parser.SEMICOLON.html +++ b/docs/variables/parser.SEMICOLON.html @@ -18,7 +18,7 @@

    Variable SEMICOLONConst

    SEMICOLON: Rule<TokenKind, tkTree> = ...
    +
  • Defined in parser.ts:82
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.lexer.html b/docs/variables/parser.lexer.html index c89441f..36407a3 100644 --- a/docs/variables/parser.lexer.html +++ b/docs/variables/parser.lexer.html @@ -21,7 +21,7 @@
    +
  • Defined in parser.ts:53
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.outputEnd.html b/docs/variables/parser.outputEnd.html index a80edfb..da1a232 100644 --- a/docs/variables/parser.outputEnd.html +++ b/docs/variables/parser.outputEnd.html @@ -21,7 +21,7 @@
    +
  • Defined in parser.ts:266
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.outputHead.html b/docs/variables/parser.outputHead.html index 2fee1a0..ed2ed40 100644 --- a/docs/variables/parser.outputHead.html +++ b/docs/variables/parser.outputHead.html @@ -21,7 +21,7 @@
    +
  • Defined in parser.ts:246
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/docs/variables/parser.outputMiddle.html b/docs/variables/parser.outputMiddle.html index 3030d3f..f26c0f1 100644 --- a/docs/variables/parser.outputMiddle.html +++ b/docs/variables/parser.outputMiddle.html @@ -21,7 +21,7 @@
    +
  • Defined in parser.ts:258
  • +
  • libclo/breakLines
  • +
  • parser
  • +
  • pdfManipulate
  • Generated using TypeDoc

    \ No newline at end of file diff --git a/src/libclo/breakLines.js b/src/libclo/breakLines.js index 27513f3..e5d0865 100644 --- a/src/libclo/breakLines.js +++ b/src/libclo/breakLines.js @@ -1,95 +1,149 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.totalCost = void 0; +exports.BreakLineAlgorithm = void 0; /** - * Algorithms in LATEX language -TotalCost(i) = min_{j}~TotalCost(j) + LineCost(j, i)~~~~j=0, 1, ..., i-1 - -LineCost(j, i)= \begin{cases} -\infty ~~~ if~~LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - newLineWidth(item[i]) < 0 \\ -\infty~~if~~NOT~~breakable(item[i]) \\ -(LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - newLineWidth(item[i]))^3 ~~elsewhere -\end{cases} */ -/**check if a boeitem is BreakPoint Type */ -function isBreakPoint(item) { - return item.newLined !== undefined; -} -/**check if a boeitem is BreakPoint Type */ -function isHGlue(item) { - return item.stretchFactor !== undefined; -} -/** measuring original advance width */ -function origWidth(item) { - if (isBreakPoint(item)) { - console.log(item); - return origWidth(item.original); + * Algorithms in LATEX-like language + */ +class BreakLineAlgorithm { + constructor() { + this.prevNodes = []; + this.totalCostAuxStorage = []; + this.lineCostStorage = [[]]; } - else if (Array.isArray(item)) { - return item.map((x) => origWidth(x)) - .reduce((acc, current) => acc + current, 0.0); + /**check if a boeitem is BreakPoint Type */ + isBreakPoint(item) { + return item.newLined !== undefined; } - else if (isHGlue(item)) { - return 0.0; + /**check if a boeitem is BreakPoint Type */ + isHGlue(item) { + return item.stretchFactor !== undefined; } - else { - return item.width; + /** measuring original advance width */ + origWidth(item) { + if (this.isBreakPoint(item)) { + return this.origWidth(item.original); + } + else if (Array.isArray(item)) { + return item.map((x) => this.origWidth(x)) + .reduce((acc, current) => acc + current, 0.0); + } + else if (this.isHGlue(item)) { + return 0.0; + } + else { + return item.width; + } } -} -/** measuring new-line triggered advance width */ -function newLineWidth(item) { - if (isBreakPoint(item)) { - return origWidth(item.newLined); + segmentedNodes(items, lineWidth) { + this.totalCost(items, lineWidth); + let nodeList = this.generateBreakLineNodeList(); + console.log("~~~", nodeList); + let res = []; + let low = -1; + let up = nodeList[0]; + for (var i = 0; i < nodeList.length; i++) { + res.push(items.slice(low + 1, up + 1)); + low = nodeList[i]; + up = nodeList[i + 1]; + } + return res; } - else { - // impossible to make a new line - return Infinity; + /**genrate the list of point of breaking line. it returns a correct list ascending*/ + generateBreakLineNodeList() { + let res = []; + var pointer = this.prevNodes.length - 1; + while (this.prevNodes[pointer] !== undefined) { + res.push(pointer); + pointer = this.prevNodes[pointer]; + } + return res.reverse(); } -} -let lineCostStorage = new Object(); -/** - * check the total cost item[0..j]. - * @param items - * @param i - * @param lineWidth - */ -function totalCost(items, j, lineWidth) { - if (j in lineCostStorage) { - return lineCostStorage[j]; + /** measuring new-line triggered advance width */ + newLineWidth(item) { + if (this.isBreakPoint(item)) { + return this.origWidth(item.newLined); + } + else { + // impossible to make a new line + return Infinity; + } } - var returnCost = Infinity; - for (var i = -1; i <= j; i++) { - // lineCost - let lCost = lineCost(items, i, j, lineWidth); - if (returnCost > lCost) { - returnCost = lCost; + /** + * check all the total cost of paragraphes of the segnemt + */ + totalCost(items, lineWidth) { + let itemsLength = items.length; + this.lineCostStorage = Array(itemsLength); + this.prevNodes = Array(itemsLength).fill(null); + for (var i = 0; i < itemsLength; i++) { + this.lineCostStorage[i] = Array(itemsLength).fill(undefined); } + this.totalCostAuxStorage = Array(itemsLength).fill(undefined); + console.log("===", itemsLength); + let a = this.totalCostAux(items, itemsLength - 1, lineWidth); + console.log(this.lineCostStorage); + return a; } - lineCostStorage[j] = returnCost; - return returnCost; -} -exports.totalCost = totalCost; -/** - * check the line cost of a line containing items[i+1..j] - * @param items items of box - * @param i beginning (excluded) - * @param j end of the line - * @param lineWidth line width - */ -function lineCost(items, i, j, lineWidth) { - if (!isBreakPoint(items[j])) { - return Infinity; + /** + * check the total cost item[0..j]. + * @param items + * @param i + * @param lineWidth + */ + totalCostAux(items, j, lineWidth) { + if (this.totalCostAuxStorage[j] !== undefined) { + return this.totalCostAuxStorage[j]; + } + let rawLineCost = this.lineCost(items, 0, j, lineWidth); + if (rawLineCost != Infinity) { + this.totalCostAuxStorage[j] = rawLineCost; + return rawLineCost; + } + else { + var returnCost = Infinity; + for (var k = 0; k < j; k++) { + let tmp = this.totalCostAux(items, k, lineWidth) + this.lineCost(items, k + 1, j, lineWidth); + if (returnCost > tmp) { + this.prevNodes[j] = k; + returnCost = tmp; + } + } + this.totalCostAuxStorage[j] = returnCost; + return returnCost; + } + return returnCost; } - else { - var tmpItemWidth = 0; - for (var k = i + 1; k < j; k++) { - tmpItemWidth += origWidth(items[k]); + /** + * check the line cost of a line containing items[i..j] + * @param items items of box + * @param i beginning (excluded) + * @param j end of the line + * @param lineWidth line width + */ + lineCost(items, i, j, lineWidth) { + if (this.lineCostStorage[i] !== undefined && this.lineCostStorage[i][j] !== undefined) { + return this.lineCostStorage[i][j]; } - tmpItemWidth += newLineWidth(items[j]); - if (tmpItemWidth > lineWidth) { + if (!this.isBreakPoint(items[j])) { + this.lineCostStorage[i][j] = Infinity; return Infinity; } else { - return (lineWidth - tmpItemWidth) ** 3.0; + var tmpItemWidth = 0; + for (var k = i; k < j; k++) { + tmpItemWidth += this.origWidth(items[k]); + } + tmpItemWidth += this.newLineWidth(items[j]); + if (tmpItemWidth > lineWidth) { + this.lineCostStorage[i][j] = Infinity; + return Infinity; + } + else { + let returnValue = (lineWidth - tmpItemWidth) ** 3.0; + this.lineCostStorage[i][j] = returnValue; + return returnValue; + } } } } +exports.BreakLineAlgorithm = BreakLineAlgorithm; diff --git a/src/libclo/breakLines.ts b/src/libclo/breakLines.ts index 989ba93..0392a23 100644 --- a/src/libclo/breakLines.ts +++ b/src/libclo/breakLines.ts @@ -3,107 +3,182 @@ */ import { join } from "path"; import {BreakPoint, BoxesItem, HGlue} from "./index.js"; +import { listenerCount } from "process"; +import { unwatchFile } from "fs"; /** - * Algorithms in LATEX language -TotalCost(i) = min_{j}~TotalCost(j) + LineCost(j, i)~~~~j=0, 1, ..., i-1 - -LineCost(j, i)= \begin{cases} -\infty ~~~ if~~LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - newLineWidth(item[i]) < 0 \\ -\infty~~if~~NOT~~breakable(item[i]) \\ -(LineWidth - \sum_{k=j+1}^{i-1} OrigWidth(item[k]) - newLineWidth(item[i]))^3 ~~elsewhere -\end{cases} */ - -/**check if a boeitem is BreakPoint Type */ -function isBreakPoint (item : any) : item is BreakPoint{ - return (item as BreakPoint).newLined !== undefined; -} - -/**check if a boeitem is BreakPoint Type */ -function isHGlue (item : any) : item is HGlue{ - return (item as HGlue).stretchFactor !== undefined; -} - - -/** measuring original advance width */ -function origWidth(item : BoxesItem) : number{ - if (isBreakPoint(item)){ - console.log(item); - return origWidth(item.original); - }else if(Array.isArray(item)){ - return item.map((x)=>origWidth(x)) - .reduce((acc, current) => acc + current, - 0.0,) - }else if(isHGlue(item)){ - return 0.0; + * Algorithms in LATEX-like language + */ + +export class BreakLineAlgorithm { + + lineCostStorage : number[][]; + totalCostAuxStorage : number[]; + prevNodes : number[]; + + + + constructor(){ + this.prevNodes = []; + this.totalCostAuxStorage = []; + this.lineCostStorage = [[]]; } - else{ - return item.width; + + /**check if a boeitem is BreakPoint Type */ + isBreakPoint (item : any) : item is BreakPoint{ + return (item as BreakPoint).newLined !== undefined; } -} - -/** measuring new-line triggered advance width */ -function newLineWidth(item : BoxesItem) : number{ - if (isBreakPoint(item)){ - return origWidth(item.newLined); - }else{ - // impossible to make a new line - return Infinity; + + /**check if a boeitem is HGlue Type */ + isHGlue (item : any) : item is HGlue{ + return (item as HGlue).stretchFactor !== undefined; } -} -let lineCostStorage : any = new Object(); -/** - * check the total cost item[0..j]. - * @param items - * @param i - * @param lineWidth - */ -export function totalCost(items : BoxesItem[], j : number, lineWidth: number){ - if (j in lineCostStorage){ - return lineCostStorage[j]; + /** measuring original advance width */ + origWidth(item : BoxesItem) : number{ + if (this.isBreakPoint(item)){ + return this.origWidth(item.original); + }else if(Array.isArray(item)){ + return item.map((x)=>this.origWidth(x)) + .reduce((acc, current) => acc + current, + 0.0,) + }else if(this.isHGlue(item)){ + return 0.0; + } + else{ + return item.width; + } + } + + segmentedNodes(items : BoxesItem[], lineWidth : number) : BoxesItem[][]{ + this.totalCost(items ,lineWidth); + let nodeList = this.generateBreakLineNodeList(); + console.log("~~~", nodeList); + let res = []; + let low = -1; + let up = nodeList[0]; + + for(var i=0; i lCost){ - returnCost = lCost; + /**genrate the list of point of breaking line. it returns a correct list ascending*/ + generateBreakLineNodeList() : number[]{ + let res : number[] = []; + var pointer = this.prevNodes.length-1; + while (this.prevNodes[pointer] !== undefined){ + res.push(pointer); + pointer = this.prevNodes[pointer]; } + return res.reverse(); } - lineCostStorage[j] = returnCost; - return returnCost; + /** measuring new-line triggered advance width */ + newLineWidth(item : BoxesItem) : number{ + if (this.isBreakPoint(item)){ + return this.origWidth(item.newLined); + }else{ + // impossible to make a new line + return Infinity; + } + } + /** + * check all the total cost of paragraphes of the segnemt + */ + totalCost(items : BoxesItem[], lineWidth: number) : number{ + + let itemsLength = items.length; + this.lineCostStorage = Array(itemsLength); + this.prevNodes = Array(itemsLength).fill(null); + + + for (var i=0; i tmp){ + this.prevNodes[j] = k; + returnCost = tmp; + } + } + this.totalCostAuxStorage[j] = returnCost; + return returnCost; -/** - * check the line cost of a line containing items[i+1..j] - * @param items items of box - * @param i beginning (excluded) - * @param j end of the line - * @param lineWidth line width - */ -function lineCost(items : BoxesItem[], i : number, j : number, lineWidth: number){ - if (!isBreakPoint(items[j])){ - return Infinity; - }else{ - var tmpItemWidth = 0; - for (var k = i+1; k lineWidth){ + + /** + * check the line cost of a line containing items[i..j] + * @param items items of box + * @param i beginning (excluded) + * @param j end of the line + * @param lineWidth line width + */ + lineCost(items : BoxesItem[], i : number, j : number, lineWidth: number) : number{ + if (this.lineCostStorage[i] !== undefined && this.lineCostStorage[i][j] !== undefined){ + return this.lineCostStorage[i][j]; + } + + if (!this.isBreakPoint(items[j])){ + this.lineCostStorage[i][j] = Infinity; return Infinity; }else{ - return (lineWidth - tmpItemWidth)**3.0; + var tmpItemWidth = 0; + for (var k = i; k lineWidth){ + this.lineCostStorage[i][j] = Infinity; + return Infinity; + }else{ + let returnValue = (lineWidth - tmpItemWidth)**3.0; + this.lineCostStorage[i][j] = returnValue; + return returnValue; + } } + } } \ No newline at end of file diff --git a/src/libclo/index.js b/src/libclo/index.js index 927c0af..c2b873e 100644 --- a/src/libclo/index.js +++ b/src/libclo/index.js @@ -35,7 +35,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Clo = exports.calculateTextWidthHeightAux = exports.calculateTextWidthHeight = exports.hyphenTkTree = exports.filterEmptyString = exports.spacesToBreakpoint = exports.hyphenForClo = exports.splitCJKV = exports.twoReturnsToNewline = exports.ptToPx = exports.cjkvRegexPattern = exports.cjkvBlocksInRegex = exports.defaultFrameStyle = exports.defaultTextStyle = exports.A4_IN_PX = exports.Direction = void 0; const canva_1 = require("../canva"); const fontkit = __importStar(require("fontkit")); -const util = __importStar(require("node:util")); const breakLines = __importStar(require("./breakLines")); /** * TYPES @@ -360,11 +359,127 @@ class Clo { // generate the width and height of the stream let defaultFontStyle = this.attrs["defaultFrameStyle"].textStyle; let a = yield calculateTextWidthHeight(preprocessed, defaultFontStyle); + let breakLineAlgorithms = new breakLines.BreakLineAlgorithm(); // TODO - console.log(util.inspect(a, true, 100)); - console.log(breakLines.totalCost(a, 3, 100)); + //console.log(breakLineAlgorithms.totalCost(a,70)); + let segmentedNodes = breakLineAlgorithms.segmentedNodes(a, 70); + console.log(this.segmentedNodesToFrameBox(segmentedNodes, this.attrs["defaultFrameStyle"])); }); } + segmentedNodesToFrameBox(segmentedNodes, frame) { + let baseLineskip = frame.baseLineskip; + let boxArrayEmpty = []; + let bigBox = { + x: frame.x, + y: frame.y, + textStyle: frame.textStyle, + direction: frame.direction, + width: frame.width, + height: frame.height, + content: boxArrayEmpty, + }; + var bigBoxContent = boxArrayEmpty; + let segmentedNodesFixed = segmentedNodes.map((x) => this.removeBreakPoints(x).flat()); + let segmentedNodeUnglue = segmentedNodesFixed.map((x) => this.removeGlue(x, frame).flat()); + for (var i = 0; i < segmentedNodesFixed.length - 1; i++) { + var currentLineSkip = baseLineskip; + var glyphMaxHeight = this.getGlyphMaxHeight(segmentedNodesFixed[i]); + if (currentLineSkip === null || glyphMaxHeight > currentLineSkip) { + currentLineSkip = glyphMaxHeight; + } + var currentLineBox = { + x: null, + y: null, + textStyle: exports.defaultTextStyle, + direction: frame.directionInsideLine, + width: frame.width, + height: currentLineSkip, + content: segmentedNodeUnglue[i], + }; + bigBoxContent.push(currentLineBox); + } + bigBox.content = bigBoxContent; + return bigBox; + } + /** + * get the max height of the glyph`[a, b, c]` + * @param nodeLine the node line [a, b, c, ...] + * @returns + */ + getGlyphMaxHeight(nodeLine) { + let segmentedNodeLineHeight = nodeLine.map((x) => { if ("height" in x && x.height > 0.0) { + return x.height; + } + else { + return 0.0; + } }); + let maxHeight = Math.max(...segmentedNodeLineHeight); + return maxHeight; + } + removeGlue(nodeLine, frame) { + let breakLineAlgorithms = new breakLines.BreakLineAlgorithm(); + let glueRemoved = nodeLine.filter((x) => !breakLineAlgorithms.isHGlue(x)); + let onlyGlue = nodeLine.filter((x) => breakLineAlgorithms.isHGlue(x)); + let sumStretchFactor = onlyGlue.map((x) => { if ("stretchFactor" in x) { + return x.stretchFactor; + } + else { + return 0; + } }) + .reduce((acc, cur) => acc + cur, 0); + let glueRemovedWidth = glueRemoved.map((x) => { if ("width" in x) { + return x.width; + } + else { + return 0; + } }) + .reduce((acc, cur) => acc + cur, 0); + let offset = frame.width - glueRemovedWidth; + var res = []; + for (var i = 0; i < nodeLine.length; i++) { + var ele = nodeLine[i]; + if (breakLineAlgorithms.isHGlue(ele)) { + let tmp = { + x: null, + y: null, + textStyle: null, + direction: frame.directionInsideLine, + width: ele.stretchFactor / sumStretchFactor * offset, + height: 0, + content: "", + }; + res.push(tmp); + } + else { + res.push(ele); + } + } + return res; + } + /** + * remove breakpoints + * @param boxitemline boxitem in a line with a breakpoint + * @returns boxitemline with break points removed + */ + removeBreakPoints(boxitemline) { + var res = []; + let breakLineAlgorithms = new breakLines.BreakLineAlgorithm(); + for (var i = 0; i < boxitemline.length; i++) { + let ele = boxitemline[i]; + if (breakLineAlgorithms.isBreakPoint(ele)) { + if (i == boxitemline.length - 1) { + res.push(ele.newLined); + } + else { + res.push(ele.original); + } + } + else { + res.push(ele); + } + } + return res; + } } exports.Clo = Clo; /* diff --git a/src/libclo/index.ts b/src/libclo/index.ts index 53b837c..b64a819 100644 --- a/src/libclo/index.ts +++ b/src/libclo/index.ts @@ -438,14 +438,133 @@ export class Clo{ let defaultFontStyle : TextStyle = this.attrs["defaultFrameStyle"].textStyle; let a = await calculateTextWidthHeight(preprocessed, defaultFontStyle); + let breakLineAlgorithms = new breakLines.BreakLineAlgorithm(); // TODO - console.log(util.inspect(a, true, 100)); - console.log(breakLines.totalCost(a,3,100)); + //console.log(breakLineAlgorithms.totalCost(a,70)); + let segmentedNodes = breakLineAlgorithms.segmentedNodes(a, 70); + + console.log(this.segmentedNodesToFrameBox(segmentedNodes, this.attrs["defaultFrameStyle"])); + } + + segmentedNodesToFrameBox(segmentedNodes : BoxesItem[][], frame : FrameBox) : Box{ + let baseLineskip = frame.baseLineskip; + let boxArrayEmpty : Box[] = []; + let bigBox : Box = { + x : frame.x, + y : frame.y, + textStyle : frame.textStyle, + direction : frame.direction, + width : frame.width, + height : frame.height, + content : boxArrayEmpty, + } + + var bigBoxContent : Box[] = boxArrayEmpty; + + let segmentedNodesFixed = segmentedNodes.map((x)=>this.removeBreakPoints +(x).flat()); + let segmentedNodeUnglue = segmentedNodesFixed.map((x)=>this.removeGlue(x, frame).flat()); + + for (var i=0; icurrentLineSkip ){ + currentLineSkip = glyphMaxHeight; + } + + var currentLineBox : Box = { + x : null, + y : null, + textStyle : defaultTextStyle, + direction : frame.directionInsideLine, + width : frame.width, + height : currentLineSkip, + content : segmentedNodeUnglue[i], + } + + bigBoxContent.push(currentLineBox); + + } + + bigBox.content = bigBoxContent; + + return bigBox; + } + + /** + * get the max height of the glyph`[a, b, c]` + * @param nodeLine the node line [a, b, c, ...] + * @returns + */ + getGlyphMaxHeight(nodeLine : BoxesItem[]) : number{ + let segmentedNodeLineHeight = nodeLine.map((x : BoxesItem)=>{if ("height" in x && x.height > 0.0){return x.height}else{return 0.0}}); + let maxHeight = Math.max(...segmentedNodeLineHeight); + return maxHeight; + } + + removeGlue(nodeLine : BoxesItem[], frame : FrameBox) : BoxesItem[]{ + let breakLineAlgorithms = new breakLines.BreakLineAlgorithm(); + let glueRemoved = nodeLine.filter((x)=>!breakLineAlgorithms.isHGlue(x)); + let onlyGlue = nodeLine.filter((x)=>breakLineAlgorithms.isHGlue(x)); + let sumStretchFactor = onlyGlue.map((x)=>{if("stretchFactor" in x){ return x.stretchFactor} else{return 0;}}) + .reduce((acc, cur)=>acc+cur , 0); + + let glueRemovedWidth = glueRemoved.map((x)=>{if("width" in x){ return x.width} else{return 0;}}) + .reduce((acc, cur)=>acc+cur , 0); + let offset = frame.width - glueRemovedWidth; + var res = []; + for (var i=0; i