Skip to content

Conversation

gewill
Copy link

@gewill gewill commented Apr 28, 2023

What's this PR do?

  • Fix font size by set viewport, that means we set point as font size.
  • Add line height, then we can calculate the code viewer's total height.

Here is an example, how set CodeViewer height:

   CodeViewer(content: .constant(code), mode: CodeWebView.Mode(rawValue: configuration.language ?? "") ?? .text, darkTheme: .tomorrow_night_eighties, lightTheme: .tomorrow, isReadOnly: true, fontSize: 14, lineHeight: 1.3)
          .frame(height: CGFloat(code.components(separatedBy: .newlines).count) * 14 * 1.3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant