Skip to content

Commit

Permalink
Merge pull request #1224 from dpc-sdp/bugfix/SDPAP-9439-ar-font
Browse files Browse the repository at this point in the history
[SDPAP-9439] support quick type adjustments for language fonts
  • Loading branch information
waitingallday authored Jun 17, 2024
2 parents 989e9e6 + a83c127 commit 35add5c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/nuxt-ripple/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare module '@nuxt/schema' {
name: string
url: string
rtl?: boolean
styles?: Record<string, string>
}
}
search?: {
Expand Down Expand Up @@ -71,7 +72,10 @@ export default defineAppConfig({
ar: {
name: 'Noto Kufi Arabic',
url: 'https://fonts.googleapis.com/earlyaccess/notokufiarabic.css',
rtl: true
rtl: true,
styles: {
'.rpl-type-p-large-highlight': 'line-height: var(--rpl-type-lh-9)'
}
},
bn: {
name: 'Noto Sans Bengali',
Expand Down
10 changes: 9 additions & 1 deletion packages/nuxt-ripple/composables/use-tide-language.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@ export default (page: any) => {
const direction = computed(() => (found.value?.rtl ? 'rtl' : 'ltr'))

if (found.value) {
let customCSS = ''

if (found.value?.styles) {
Object.keys(found.value.styles).forEach((selector) => {
customCSS += `.${language.value} ${selector} { ${found.value.styles[selector]}; }`
})
}

useHead({
link: [{ rel: 'stylesheet', href: found.value?.url }],
style: [
{
children: `
.${language.value} * { font-family: '${found.value?.name}', var(--rpl-type-font-family) !important }
.${language.value} * { font-family: '${found.value?.name}', var(--rpl-type-font-family) !important } ${customCSS}
`
}
]
Expand Down

0 comments on commit 35add5c

Please sign in to comment.