-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:alpaylan/afetbilgi.com
- Loading branch information
Showing
1 changed file
with
36 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,48 @@ | ||
const boldFont = require("./fonts/Roboto-Black-normal"); | ||
const regularFont = require("./fonts/Roboto-Regular-normal") | ||
const { titleFontSize, textFontSize, xStart, yStart, yRange} = require("./constants"); | ||
const moment = require('moment'); | ||
const regularFont = require("./fonts/Roboto-Regular-normal"); | ||
const { | ||
titleFontSize, | ||
textFontSize, | ||
xStart, | ||
yStart, | ||
yRange, | ||
} = require("./constants"); | ||
const moment = require("moment"); | ||
const { default: slugify } = require("slugify"); | ||
require('moment/locale/fr.js'); | ||
require("moment/locale/fr.js"); | ||
|
||
const getDateAndTime = () => { | ||
moment.locale('tr') | ||
return moment().format('L') + ' - ' + moment().format('LT') | ||
} | ||
const date = new Date().toLocaleString("tr-TR", { | ||
timeZone: "Europe/Moscow", | ||
}); | ||
return date.toString(); | ||
}; | ||
|
||
const registerFont = (doc) => { | ||
doc.addFileToVFS("./fonts/Roboto-Black.ttf", boldFont.font); | ||
doc.addFileToVFS("./fonts/Roboto-Regular.ttf", regularFont.font); | ||
doc.addFont("./fonts/Roboto-Black.ttf", "Roboto-Black", "normal"); | ||
doc.addFont("./fonts/Roboto-Regular.ttf", "Roboto-Regular", "normal"); | ||
doc.setFont('Roboto-Regular', 'normal'); | ||
|
||
} | ||
doc.addFileToVFS("./fonts/Roboto-Black.ttf", boldFont.font); | ||
doc.addFileToVFS("./fonts/Roboto-Regular.ttf", regularFont.font); | ||
doc.addFont("./fonts/Roboto-Black.ttf", "Roboto-Black", "normal"); | ||
doc.addFont("./fonts/Roboto-Regular.ttf", "Roboto-Regular", "normal"); | ||
doc.setFont("Roboto-Regular", "normal"); | ||
}; | ||
|
||
const setFont = (doc, type) => { | ||
if (type == "regular") { | ||
doc.setFont('Roboto-Regular', 'normal'); | ||
} else { | ||
doc.setFont('Roboto-Black', 'normal'); | ||
} | ||
} | ||
if (type == "regular") { | ||
doc.setFont("Roboto-Regular", "normal"); | ||
} else { | ||
doc.setFont("Roboto-Black", "normal"); | ||
} | ||
}; | ||
|
||
const slug = (text) => { | ||
return slugify(text, { | ||
trim: true // trim leading and trailing replacement chars, defaults to `true` | ||
}) | ||
} | ||
|
||
return slugify(text, { | ||
trim: true, // trim leading and trailing replacement chars, defaults to `true` | ||
}); | ||
}; | ||
|
||
module.exports = { | ||
setFont, | ||
registerFont, | ||
getDateAndTime, | ||
slug, | ||
|
||
} | ||
setFont, | ||
registerFont, | ||
getDateAndTime, | ||
slug, | ||
}; |
8cb57a8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
afetbilgi-com – ./
afetbilgi-com-alpaylan-s-team.vercel.app
afetbilgi-com-git-main-alpaylan-s-team.vercel.app
afetbilgi-com.vercel.app
www.afetbilgi.com
afetbilgi.com