Skip to content

Commit

Permalink
🐛 pretendard extension
Browse files Browse the repository at this point in the history
  • Loading branch information
lsh1202 committed Aug 1, 2024
1 parent 5f3ff10 commit 7044bb8
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Sources/QDS/Foundation/Typography/Pretendard+Ext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@ extension QvickFont.Pretendard: QvickFont.CanDefine {

public static func register() {
QvickFont.Pretendard.allCases.forEach {
guard let fontURL = Bundle.module.url(
forResource: $0.name,
withExtension: "ttf"
),
let fontDataProvider = CGDataProvider(url: fontURL as CFURL),
let font = CGFont(fontDataProvider) else { return }
var error: Unmanaged<CFError>?
CTFontManagerRegisterGraphicsFont(font, &error)
guard let asset = NSDataAsset(name: $0.name, bundle: .module),
let provider = CGDataProvider(data: asset.data as NSData),
let font = CGFont(provider) else { return }

CTFontManagerRegisterGraphicsFont(font, nil)
}
}

Expand Down

0 comments on commit 7044bb8

Please sign in to comment.