Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 113 additions & 0 deletions app/assets/stylesheets/shared/font_faces.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,76 @@ $asset-version: "3.3";
font-display: swap;
}

@font-face {
font-family: "qpc-v4-bismillah-color";
src: url("#{$font-cdn}/quran_fonts/bismillah_color/QCF_Bismillah_COLOR-Regular.woff2?v=#{$asset-version}") format("woff2"),
url("#{$font-cdn}/quran_fonts/bismillah_color/QCF_Bismillah_COLOR-Regular.woff?v=#{$asset-version}") format("woff"),
url("#{$font-cdn}/quran_fonts/bismillah_color/QCF_Bismillah_COLOR-Regular.ttf?v=#{$asset-version}") format("truetype");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'arabic-sign-font';
src: url("#{$font-cdn}/arabic-sign/arabic_sign_font.woff2?v=#{$asset-version}") format("woff2"),
url("#{$font-cdn}/arabic-sign/arabic_sign_font.woff?v=#{$asset-version}") format("woff"),
url("#{$font-cdn}/arabic-sign/arabic_sign_font.ttf?v=#{$asset-version}") format("truetype");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'v4-tajweed-ot_svg_dark';
src: url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_dark/ttf/p1.ttf") format("truetype"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_dark/woff/p1.woff") format("woff"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_dark/woff2/p1.woff2") format("woff2");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'v4-tajweed-ot_svg_light';
src: url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_light/ttf/p1.ttf") format("truetype"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_light/woff/p1.woff") format("woff"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_light/woff2/p1.woff2") format("woff2");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'v4-tajweed-ot_svg_sepia';
src: url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_sepia/ttf/p1.ttf") format("truetype"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_sepia/woff/p1.woff") format("woff"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/ot_svg_sepia/woff2/p1.woff2") format("woff2");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'v4-tajweed-dark_mood';
src: url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/dark_mood/ttf/p1.ttf") format("truetype"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/dark_mood/woff/p1.woff") format("woff"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4-tajweed/dark_mood/woff2/p1.woff2") format("woff2");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: 'v4';
src: url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4/woff2/p1.woff2") format("woff2"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4/woff/p1.woff") format("woff"),
url("https://static-cdn.tarteel.ai/qul/fonts/quran_fonts/v4/ttf/p1.ttf") format("truetype");
font-weight: normal;
font-style: normal;
font-display: swap;
}

@font-face {
font-family: quran-icon;
src: url("#{$font-cdn}/common/quran-common.woff2?v=#{$asset-version}"),
Expand Down Expand Up @@ -131,6 +201,49 @@ $asset-version: "3.3";
font-size: xxx-large;
}

.qpc-v4-bismillah-color {
font-family: "qpc-v4-bismillah-color" !important;
direction: rtl;
font-size: 30px;
}

.arabic-sign-font {
font-family: 'arabic-sign-font' !important;
direction: rtl;
font-size: 30px;
}

.font-v4-tajweed-ot-svg-dark {
font-family: 'v4-tajweed-ot_svg_dark' !important;
direction: rtl;
font-size: 30px;
}

.font-v4-tajweed-ot-svg-light {
font-family: 'v4-tajweed-ot_svg_light' !important;
direction: rtl;
font-size: 30px;
}

.font-v4-tajweed-ot-svg-sepia {
font-family: 'v4-tajweed-ot_svg_sepia' !important;
direction: rtl;
font-size: 30px;
}

.font-v4-tajweed-dark-mood {
font-family: 'v4-tajweed-dark_mood' !important;
direction: rtl;
font-size: 30px;
}

.v4 {
font-family: 'v4' !important;
direction: rtl;
font-size: 30px;
}


.pdms-saleem{
font-family: pdms-saleem;
font-size: 30px;
Expand Down
61 changes: 34 additions & 27 deletions app/views/resources/previews/_font.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,43 @@
resource_content = resource.resource_content
sample_text = resource_content.meta_value('text')
font_face = resource_content.meta_value('font-face')

font_base_path = resource_content.meta_value('ttf')
font_format = 'ttf'
font_extension = '.ttf'

unless font_base_path.present?
font_base_path = resource_content.meta_value('woff2')
font_format = 'woff2'
font_extension = '.woff2'
end

unless font_base_path.present?
font_base_path = resource_content.meta_value('woff')
font_format = 'woff'
font_extension = '.woff'
end

unless font_base_path.present?
font_base_path = resource_content.meta_value('otf')
font_format = 'otf'
font_extension = '.otf'
end

ligatures = resource_content.meta_value('ligatures')
preview_pattern = resource_content.meta_value('preview-pattern') ||
resource_content.meta_value('preview_pattern')

page_key = (params[:page].presence || 'p1').to_s

if ligatures.present?
ligatures = Oj.load(ligatures)
if preview_pattern.present?
preview_base = preview_pattern.sub(/p\d+$/, page_key)
font_url = "https://static-cdn.tarteel.ai/qul/fonts/#{preview_base}#{font_extension}"
else
font_url = "https://static-cdn.tarteel.ai/qul/fonts/#{font_base_path}#{font_extension}"
end

font_url = "https://static-cdn.tarteel.ai/qul/fonts/#{font_base_path}#{font_extension}"
ligatures = resource_content.meta_value('ligatures')
ligatures = Oj.load(ligatures) if ligatures.present?
%>

<link rel="preload" href="<%= font_url %>" as="fetch" crossorigin="anonymous">
Expand Down Expand Up @@ -78,7 +85,7 @@
</li>
</ul>

<div class="tab-content tw-p-2 tw-mt-3" id="font-docs-tab-content"
<div class="tab-content tw-p-2 tw-mt-3" id="font-docs-tab-content"
data-controller="font-preview"
data-font-preview-font-url-value="<%= font_url %>"
data-font-preview-font-format-value="<%= font_format %>"
Expand Down Expand Up @@ -123,12 +130,12 @@
<li>
<strong>Define a <code>@font-face</code> Rule in Your CSS</strong>
<pre class="tw-bg-gray-100 tw-rounded tw-p-4 tw-overflow-auto tw-text-sm"><code>
@font-face {
@font-face {
font-family: '<%= font_face %>';
src: url('<%= font_url %>') format('<%= font_format == 'woff2' ? 'woff2' : font_format == 'woff' ? 'woff' : font_format == 'otf' ? 'opentype' : 'truetype' %>');
font-display: swap;
}
</code></pre>
</code></pre>
</li>

<li>
Expand All @@ -139,10 +146,10 @@
</ul>
<pre class="bg-gray-100 tw-p-4 tw-rounded text-sm overflow-auto tw-mb-4">
<code><code>
&lt;div style="font-family: '<%= font_face %>';"&gt;
&lt;div style="font-family: '<%= font_face %>';"&gt;
<%= sample_text %>
&lt;/div&gt;
</code></code>
</code></code>
</pre>

<ul class="list-disc list-inside tw-mb-4">
Expand Down Expand Up @@ -210,19 +217,19 @@
</thead>

<tbody data-font-preview-target="ligaturesTable">
<% i = 0 %>
<% ligatures.each do |key, val| %>
<tr>
<td><%= i+=1 %></td>
<td><%= val %></td>
<td><%= key %></td>
<td>
<div class="ligature-preview">
<%= val %>
</div>
</td>
</tr>
<% end %>
<% i = 0 %>
<% ligatures.each do |key, val| %>
<tr>
<td><%= i+=1 %></td>
<td><%= val %></td>
<td><%= key %></td>
<td>
<div class="ligature-preview">
<%= val %>
</div>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
Expand Down Expand Up @@ -264,4 +271,4 @@
}
</style>

</div>
</div>
Loading