Skip to content

Commit

Permalink
chore: fixed documentation can't be watched for line-height and size …
Browse files Browse the repository at this point in the history
…parsers
  • Loading branch information
CatHood0 committed Jul 9, 2024
1 parent 106722b commit 8e148ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 11 additions & 5 deletions lib/parser/font_size_parser.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
// constant centimeters multiplier
const double cmSizeMultiplier = 37.7952755906;
// constant millimeters multiplier
const double mmSizeMultiplier = 3.7795275591;
// constant inches multiplier
const double inchSizeMultiplier = 96;
// constant points multiplier
const double pointSizeMultiplier = 1.3333333333;
// constant picas multiplier
const double picasSizeMultiplier = 16;

/// Converts various CSS units to pixels (px).
///
/// This function supports the following units:
Expand Down Expand Up @@ -29,11 +40,6 @@
/// [rootFontSize] is the font-size of the root element, used for `rem` units.
///
/// Returns the equivalent value in pixels.
const double cmSizeMultiplier = 37.7952755906;
const double mmSizeMultiplier = 3.7795275591;
const double inchSizeMultiplier = 96;
const double pointSizeMultiplier = 1.3333333333;
const double picasSizeMultiplier = 16;
double parseSizeToPx(
String value, {
double fontSizeEmMultiplier = 16.0,
Expand Down
3 changes: 2 additions & 1 deletion lib/parser/line_height_parser.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/// constant common line-height multiplier
const normalLineHeightMultiplier = 1.2;
/// Parses a CSS `line-height` value to a pixel value based on the specified [fontSize] and optional [rootFontSize].
///
/// Supports unitless values, percentages, pixels (`px`), ems (`em`), rems (`rem`), and the keyword `normal`.
Expand Down Expand Up @@ -25,7 +27,6 @@
/// print(parseLineHeight('1.5em')); // 24.0 (16 * 1.5)
/// print(parseLineHeight('1.2rem')); // 19.2 (16 * 1.2)
/// ```
const normalLineHeightMultiplier = 1.2;
double parseLineHeight(String lineHeight, {double fontSize = 16, double rootFontSize = 16}) {
// Convert line-height values
double parsedValue;
Expand Down

0 comments on commit 8e148ac

Please sign in to comment.