Skip to content

Commit

Permalink
Add generic font-families for serif and sans-serif (#65)
Browse files Browse the repository at this point in the history
Add generic font-families for serif and sans-serif
  • Loading branch information
Sohn123 committed Jul 7, 2022
1 parent 3a2fa53 commit 8bcca05
Show file tree
Hide file tree
Showing 10 changed files with 22,666 additions and 9,823 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
defaultSVGTextStyle

self installDefaultSVGTextStyle.
^ self named: #OpenSans
^ self named: #'sans-serif'
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
*SVG-Morphic
installDefaultSVGTextStyle

(self actualTextStyles includesKey: #OpenSans)
((self actualTextStyles includesKey: #serif) and: [self actualTextStyles includesKey: #'sans-serif'])
ifTrue: [^ self].

TTCFont newTextStyleFromTTStream: (ReadStream on:(TextStyle openSansData base64Decoded asByteArray))
TTCFont newTextStyleFromTTStream: (ReadStream on:(TextStyle sansData base64Decoded asByteArray)).
TTCFont newTextStyleFromTTStream: (ReadStream on:(TextStyle serifData base64Decoded asByteArray))
9,811 changes: 0 additions & 9,811 deletions packages/SVG-Morphic.package/TextStyle.extension/class/openSansData.st

This file was deleted.

2,406 changes: 2,406 additions & 0 deletions packages/SVG-Morphic.package/TextStyle.extension/class/sansData.st

Large diffs are not rendered by default.

20,246 changes: 20,246 additions & 0 deletions packages/SVG-Morphic.package/TextStyle.extension/class/serifData.st

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"class" : {
"defaultSVGFont" : "tw 5/31/2022 16:51",
"defaultSVGTextStyle" : "tw 5/31/2022 16:51",
"installDefaultSVGTextStyle" : "tw 5/31/2022 16:51",
"openSansData" : "tw 5/31/2022 16:34" },
"defaultSVGTextStyle" : "AS 7/3/2022 21:31",
"installDefaultSVGTextStyle" : "AS 7/3/2022 21:30",
"sansData" : "AS 7/3/2022 21:30",
"serifData" : "AS 7/3/2022 21:28" },
"instance" : {
} }
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
defaultFont
defaultFont

^ 'OpenSans'
^ 'sans-serif'
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ resources
knownFontTextSVG

^ '<svg>
<text font-family="OpenSans" x="60" y="34">OpenSans</text>
<text font-family="Accujen" x="60" y="34">Accujen</text>
<text font-family="Atlanta" x="60" y="80">Atlanta</text>
</svg>'
</svg>'
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ testKnownFont
|knownFonts svgTextMorph|

svgTextMorph := SVGMorph fromString: self knownFontTextSVG.
knownFonts := OrderedCollection newFrom: {'Atlanta'. 'OpenSans'}.
knownFonts := OrderedCollection newFrom: {'Atlanta'. 'Accujen'}.

(1 to: 2) do: [:i | self assert: (knownFonts at: i) equals: (svgTextMorph submorphs at: i) fontToUse familyName]
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"basicSizeTextSVG" : "tw 6/2/2022 12:05",
"basicTextSVG" : "tw 6/2/2022 13:06",
"defaultColor" : "tw 6/2/2022 12:12",
"defaultFont" : "AS 6/21/2022 12:26",
"defaultFont" : "AS 7/4/2022 14:18",
"defaultFontSize" : "tw 6/2/2022 21:31",
"knownFontTextSVG" : "lra 6/23/2022 19:13",
"scalingTextSVG" : "tw 6/2/2022 11:59",
"testDefaultFont" : "AS 6/21/2022 12:26",
"testDefaultFontInSVGText" : "lra 6/23/2022 18:55",
"testKnownFont" : "lra 6/23/2022 18:51",
"testKnownFont" : "AS 7/7/2022 16:41",
"testTextColor" : "lra 6/23/2022 18:55",
"testTextScaling" : "lra 6/23/2022 18:55",
"testTextSize" : "lra 6/23/2022 18:55",
Expand Down

0 comments on commit 8bcca05

Please sign in to comment.