Skip to content

Commit

Permalink
[Icons]: Add support for quadratic icons (#930)
Browse files Browse the repository at this point in the history
  • Loading branch information
fallaciousreasoning authored Dec 6, 2024
1 parent 1604c65 commit 5d2b395
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/scripts/icons/skiafy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

/**
* @typedef {'M' | 'm' | 'L' | 'l' | 'C' | 'c' | 'S' | 's' | 'H' | 'h' | 'V' | 'v' | 'A' | 'a'} CommandLetter
* @typedef {'M' | 'm' | 'L' | 'l' | 'C' | 'c' | 'S' | 's' | 'H' | 'h' | 'V' | 'v' | 'A' | 'a' | 'Q' | 'q' | | 'T' |' t'} CommandLetter
*/

const { JSDOM } = require('jsdom')
Expand Down Expand Up @@ -118,11 +118,20 @@ function ToCommand(letter, commandIndex) {
case 'c':
case 's':
return 'R_CUBIC_TO'
case 'Q':
return 'QUADRATIC_TO'
case 'q':
return 'R_QUADRATIC_TO'
case 'T':
return 'QUADRATIC_TO_SHORTHAND'
case 't':
return 'R_QUADRATIC_TO_SHORTHAND'
case 'Z':
case 'z':
return 'CLOSE'
}
return '~UNKNOWN~'

throw new Error(`Encountered unknown instruction "${letter}"`)
}

/**
Expand All @@ -136,6 +145,8 @@ function LengthForSvgDirective(letter) {
case 's':
return 6
case 'S':
case 'Q':
case 'q':
return 4
case 'L':
case 'l':
Expand All @@ -145,6 +156,8 @@ function LengthForSvgDirective(letter) {
case 'v':
case 'm':
case 'M':
case 'T':
case 't':
return 2
case 'A':
case 'a':
Expand Down

0 comments on commit 5d2b395

Please sign in to comment.