cambio de fuentes css

This commit is contained in:
marcos 2021-05-25 14:04:46 +02:00
parent f2c30b6c73
commit 6f09f55fec
8 changed files with 27 additions and 24 deletions

Binary file not shown.

View File

@ -263,7 +263,7 @@ function vbar_graph(
if (isset($options['y']['title']['fontFamily']) === false) {
$options['y']['title']['fontFamily'] = preg_replace(
'/.ttf/',
'Font, Arial',
'Font',
$config['fontpath']
);
}

View File

@ -4,4 +4,4 @@ Copyright (c) 2007-2014 IOLA and Ole Laursen.
Licensed under the MIT license.
*/
(function ($) { var options = { canvas: true }; var render, getTextInfo, addText; var hasOwnProperty = Object.prototype.hasOwnProperty; function init(plot, classes) { var Canvas = classes.Canvas; if (render == null) { getTextInfo = Canvas.prototype.getTextInfo, addText = Canvas.prototype.addText, render = Canvas.prototype.render } Canvas.prototype.render = function () { if (!plot.getOptions().canvas) { return render.call(this) } var context = this.context, cache = this._textCache; context.save(); context.textBaseline = "middle"; for (var layerKey in cache) { if (hasOwnProperty.call(cache, layerKey)) { var layerCache = cache[layerKey]; for (var styleKey in layerCache) { if (hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey], updateStyles = true; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { var info = styleCache[key], positions = info.positions, lines = info.lines; if (updateStyles) { context.fillStyle = info.font.color; context.font = info.font.definition; updateStyles = false } for (var i = 0, position; position = positions[i]; i++) { if (position.active) { for (var j = 0, line; line = position.lines[j]; j++) { context.fillText(lines[j].text, line[0], line[1]) } } else { positions.splice(i--, 1) } } if (positions.length == 0) { delete styleCache[key] } } } } } } } context.restore() }; Canvas.prototype.getTextInfo = function (layer, text, font, angle, width) { if (!plot.getOptions().canvas) { return getTextInfo.call(this, layer, text, font, angle, width) } var textStyle, layerCache, styleCache, info; text = "" + text; if (typeof font === "object") { textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family } else { textStyle = font } layerCache = this._textCache[layer]; if (layerCache == null) { layerCache = this._textCache[layer] = {} } styleCache = layerCache[textStyle]; if (styleCache == null) { styleCache = layerCache[textStyle] = {} } info = styleCache[text]; if (info == null) { var context = this.context; if (typeof font !== "object") { var element = $("<div>&nbsp;</div>").css("position", "absolute").addClass(typeof font === "string" ? font : null).appendTo(this.getTextLayer(layer)); font = { lineHeight: element.height(), style: element.css("font-style"), variant: element.css("font-variant"), weight: element.css("font-weight"), family: element.css("font-family"), color: element.css("color") }; font.size = element.css("line-height", 1).height(); element.remove() } textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family; info = styleCache[text] = { width: 0, height: 0, positions: [], lines: [], font: { definition: textStyle, color: font.color } }; context.save(); context.font = textStyle; var lines = (text + "").replace(/<br ?\/?>|\r\n|\r/g, "\n").split("\n"); for (var i = 0; i < lines.length; ++i) { var lineText = lines[i], measured = context.measureText(lineText); info.width = Math.max(measured.width, info.width); info.height += font.lineHeight; info.lines.push({ text: lineText, width: measured.width, height: font.lineHeight }) } context.restore() } return info }; Canvas.prototype.addText = function (layer, x, y, text, font, angle, width, halign, valign) { if (!plot.getOptions().canvas) { return addText.call(this, layer, x, y, text, font, angle, width, halign, valign) } var info = this.getTextInfo(layer, text, font, angle, width), positions = info.positions, lines = info.lines; y += info.height / lines.length / 2; if (valign == "middle") { y = Math.round(y - info.height / 2) } else if (valign == "bottom") { y = Math.round(y - info.height) } else { y = Math.round(y) } if (!!(window.opera && window.opera.version().split(".")[0] < 12)) { y -= 2 } for (var i = 0, position; position = positions[i]; i++) { if (position.x == x && position.y == y) { position.active = true; return } } position = { active: true, lines: [], x: x, y: y }; positions.push(position); for (var i = 0, line; line = lines[i]; i++) { if (halign == "center") { position.lines.push([Math.round(x - line.width / 2), y]) } else if (halign == "right") { position.lines.push([Math.round(x - line.width), y]) } else { position.lines.push([Math.round(x), y]) } y += line.height } } } $.plot.plugins.push({ init: init, options: options, name: "canvas", version: "1.0" }) })(jQuery);
(function ($) { var options = { canvas: true }; var render, getTextInfo, addText; var hasOwnProperty = Object.prototype.hasOwnProperty; function init(plot, classes) { var Canvas = classes.Canvas; if (render == null) { getTextInfo = Canvas.prototype.getTextInfo, addText = Canvas.prototype.addText, render = Canvas.prototype.render } Canvas.prototype.render = function () { if (!plot.getOptions().canvas) { return render.call(this) } var context = this.context, cache = this._textCache; context.save(); context.textBaseline = "middle"; for (var layerKey in cache) { if (hasOwnProperty.call(cache, layerKey)) { var layerCache = cache[layerKey]; for (var styleKey in layerCache) { if (hasOwnProperty.call(layerCache, styleKey)) { var styleCache = layerCache[styleKey], updateStyles = true; for (var key in styleCache) { if (hasOwnProperty.call(styleCache, key)) { var info = styleCache[key], positions = info.positions, lines = info.lines; if (updateStyles) { context.fillStyle = info.font.color; context.font = info.font.definition; updateStyles = false } for (var i = 0, position; position = positions[i]; i++) { if (position.active) { for (var j = 0, line; line = position.lines[j]; j++) { context.fillText(lines[j].text, line[0], line[1]) } } else { positions.splice(i--, 1) } } if (positions.length == 0) { delete styleCache[key] } } } } } } } context.restore() }; Canvas.prototype.getTextInfo = function (layer, text, font, angle, width) { if (!plot.getOptions().canvas) { return getTextInfo.call(this, layer, text, font, angle, width) } var textStyle, layerCache, styleCache, info; text = "" + text; if (typeof font === "object") { textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family } else { textStyle = font } layerCache = this._textCache[layer]; if (layerCache == null) { layerCache = this._textCache[layer] = {} } styleCache = layerCache[textStyle]; if (styleCache == null) { styleCache = layerCache[textStyle] = {} } info = styleCache[text]; if (info == null) { var context = this.context; if (typeof font !== "object") { var element = $("<div>&nbsp;</div>").css("position", "absolute").addClass(typeof font === "string" ? font : null).appendTo(this.getTextLayer(layer)); console.log("entra"); font = { lineHeight: element.height(), style: element.css("font-style"), variant: element.css("font-variant"), weight: element.css("font-weight"), family: element.css("font-family"), color: element.css("color") }; font.size = element.css("line-height", 1).height(); element.remove() } textStyle = font.style + " " + font.variant + " " + font.weight + " " + font.size + "px " + font.family; info = styleCache[text] = { width: 0, height: 0, positions: [], lines: [], font: { definition: textStyle, color: font.color } }; context.save(); context.font = textStyle; var lines = (text + "").replace(/<br ?\/?>|\r\n|\r/g, "\n").split("\n"); for (var i = 0; i < lines.length; ++i) { var lineText = lines[i], measured = context.measureText(lineText); info.width = Math.max(measured.width, info.width); info.height += font.lineHeight; info.lines.push({ text: lineText, width: measured.width, height: font.lineHeight }) } context.restore() } return info }; Canvas.prototype.addText = function (layer, x, y, text, font, angle, width, halign, valign) { if (!plot.getOptions().canvas) { return addText.call(this, layer, x, y, text, font, angle, width, halign, valign) } var info = this.getTextInfo(layer, text, font, angle, width), positions = info.positions, lines = info.lines; y += info.height / lines.length / 2; if (valign == "middle") { y = Math.round(y - info.height / 2) } else if (valign == "bottom") { y = Math.round(y - info.height) } else { y = Math.round(y) } if (!!(window.opera && window.opera.version().split(".")[0] < 12)) { y -= 2 } for (var i = 0, position; position = positions[i]; i++) { if (position.x == x && position.y == y) { position.active = true; return } } position = { active: true, lines: [], x: x, y: y }; positions.push(position); for (var i = 0, line; line = lines[i]; i++) { if (halign == "center") { position.lines.push([Math.round(x - line.width / 2), y]) } else if (halign == "right") { position.lines.push([Math.round(x - line.width), y]) } else { position.lines.push([Math.round(x), y]) } y += line.height } } } $.plot.plugins.push({ init: init, options: options, name: "canvas", version: "1.0" }) })(jQuery);

View File

@ -629,7 +629,7 @@ function pandoraFlotVBars(settings) {
}
settings.x.font.family = "lato";
settings.y.font.family = "lato";
settings.y.title.fontFamily = "lato";
var options = {
series: {
bars: {
@ -753,12 +753,14 @@ function pandoraFlotSlicebar(
}
font_size = parseInt(font_size);
if (font != undefined)
font = font
.split("/")
.pop()
.split(".")
.shift();
if (font != undefined) console.log(font);
font = font
.split("/")
.pop()
.split(".")
.shift();
console.log(font);
// Check possible adapt_keys on classes
check_adaptions(graph_id);

View File

@ -448,7 +448,7 @@ document.writeln(
'margin: 2px 1px;' +
'font-weight: bold;' +
'font-size: 10pt;' +
'font-family: fixedSys;}' +
'font-family: lato;}' +
'td.scwWeekNumberHead,' +
'td.scwWeek {padding: 0px;' +
'text-align: center;' +
@ -598,8 +598,8 @@ var scwTargetEle,
Date.prototype.scwFormat =
function (scwFormat) {
var charCount = 0,
codeChar = '',
result = '';
codeChar = '',
result = '';
for (var i = 0; i <= scwFormat.length; i++) {
if (i < scwFormat.length && scwFormat.charAt(i) == codeChar) {// If we haven't hit the end of the string and
@ -659,7 +659,7 @@ String.prototype.scwPadLeft =
Function.prototype.runsAfterSCW =
function () {
var func = this,
args = new Array(arguments.length);
args = new Array(arguments.length);
for (var i = 0; i < args.length; ++i) { args[i] = arguments[i]; }
@ -787,9 +787,9 @@ function scwShow(scwEle, scwSourceEle) {
else {
function scwInputFormat() {
var scwArrSeed = new Array(),
scwArrInput = scwDateValue.
split(new RegExp('[\\' + scwArrDelimiters.
join('\\') + ']+', 'g'));
scwArrInput = scwDateValue.
split(new RegExp('[\\' + scwArrDelimiters.
join('\\') + ']+', 'g'));
// "Escape" all the user defined date delimiters above -
// several delimiters will need it and it does no harm for
@ -1177,7 +1177,7 @@ function scwBeginDrag(event) {
if (scwID('scwIframe')) {
scwID('scwIframe').style.left =
(scwEvt.clientX - deltaX) + 'px';
(scwEvt.clientX - deltaX) + 'px';
scwID('scwIframe').style.top =
(scwEvt.clientY - deltaY) + 'px';
}
@ -1356,19 +1356,19 @@ function scwShowMonth(scwBias) {// Set the selectable Month and Year
function scwSetOutput(scwOutputDate) {
if (typeof scwTargetEle.value == 'undefined') {
scwTriggerEle.scwTextNode.
replaceData(0, scwTriggerEle.scwLength,
scwOutputDate.scwFormat(scwDateOutputFormat));
replaceData(0, scwTriggerEle.scwLength,
scwOutputDate.scwFormat(scwDateOutputFormat));
}
else {
scwTargetEle.value =
scwOutputDate.scwFormat(scwDateOutputFormat);
scwOutputDate.scwFormat(scwDateOutputFormat);
}
scwHide();
}
function scwCellOutput(scwEvt) {
var scwEle = scwEventTrigger(scwEvt),
scwOutputDate = new Date(scwStartDate);
scwOutputDate = new Date(scwStartDate);
if (scwEle.nodeType == 3) scwEle = scwEle.parentNode;
@ -1496,7 +1496,7 @@ function scwShowMonth(scwBias) {// Set the selectable Month and Year
var scwCols = scwRows.childNodes[j];
if (scwCols.nodeType == 1 && scwCols.tagName == 'TD') {
scwRows.childNodes[j].innerHTML =
scwShowDate.getDate();
scwShowDate.getDate();
var scwCell = scwRows.childNodes[j],
scwDisabled =
((scwOutOfRangeDisable &&
@ -1604,7 +1604,7 @@ function scwShowMonth(scwBias) {// Set the selectable Month and Year
if (scwID('scwIFrame')) {
scwRows.childNodes[j].onmouseover =
scwChangeClass;
scwChangeClass;
scwRows.childNodes[j].onmouseout =
scwChangeClass;
}

View File

@ -5910,6 +5910,7 @@ table.table_modal_alternate tr td:first-child {
.bars-graph-rotate .flot-text .flot-x-axis div .break_word {
word-break: break-word;
font-family: "lato" !important;
}
.flot-text {

File diff suppressed because one or more lines are too long